三九宝宝网宝宝教育学龄段教育

课程设计题目1:舞伴配对模拟

01月06日 编辑 39baobao.com

[大班科学探索活动——快乐来配对]活动目标:1、尝试将有关联性的物体进行匹配。2、学习用连贯的语言表达相关联的事物之间的关系。活动准备:连线笔,教学挂图。活动过程:一、谈话导入,1、你们有好朋友吗?说一说...+阅读

具体算法及相关的类型定义 typedef struct{ char name[20]; char sex; //性别,'F'表示女性,'M'表示男性 }Person; typedef Person DataType; //将队列中元素的数据类型改为Person void DancePartner(Person dancer[],int num) {//结构数组dancer中存放跳舞的男女,num是跳舞的人数。 int i; Person p; CirQueue Mdancers,Fdancers; InitQueue(&Mdancers);//男士队列初始化 InitQueue(&Fdancers);//女士队列初始化 for(i=0;i p=dancer[i]; if(p.sex=='F') EnQueue(&Fdancers.p); //排入女队 else EnQueue(&Mdancers.p); //排入男队 } printf("The dancing partners are: \n \n"); while(!QueueEmpty(&Fdancers)&!QueueEmpty(&Mdancers)){ //依次输入男女舞伴名 p=DeQueue(&Fdancers); //女士出队 printf("%s ",p.name);//打印出队女士名 p=DeQueue(&Mdancers); //男士出队 printf("%s\n",p.name); //打印出队男士名 } if(!QueueEmpty(&Fdancers)){ //输出女士剩余人数及队头女士的名字 printf("\n There are %d women waitin for the next round.\n",Fdancers.count); p=QueueFront(&Fdancers); //取队头 printf("%s will be the first to get a partner. \n",p.name); }else if(!QueueEmpty(&Mdancers)){//输出男队剩余人数及队头者名字 printf("\n There are%d men waiting for the next round.\n",Mdacers.count); p=QueueFront(&Mdancers); printf("%s will be the first to get a partner.\n",p.name); } }//DancerPartners 参考程序如下,供大家阅读: #include #include #include #define MaxNumber 100 typedef struct{ char name[20]; char sex[4]; /*性别,'F'表示女性,'M'表示男性*/ }Person; /* 将队列中元素的数据类型改为Person*/ typedef struct { Person data[MaxNumber]; int front; int rear; }CirQueue; CirQueue *InitQueue() { CirQueue *q; q=(CirQueue*)malloc(sizeof(CirQueue)); q->front=q->rear=0; return q; } int QueueEmpty(CirQueue *q) { return(q->front==q->rear); } int EnQueue(CirQueue *q,Person x) { if((q->rear+1)%MaxNumber==q->front) { printf( "\nOverflow !\n "); return 0; } q->data[q->rear]=x; q->rear=(q->rear+1)%MaxNumber; return 1; } Person DeQueue(CirQueue *q) { Person x; if(q->front==q->rear) { printf( "\nThe queue is empty ! Can 't delete !\n "); return ; } x=q->data[q->front]; q->front=(q->front+1)%MaxNumber; return x; } void DancePartner(Person dancer[],int num) { /*结构数组dancer中存放跳舞的男女,num是跳舞的人数*/ CirQueue *Mdancers,*Fdancers; int i, count=0; Person p; Mdancers=InitQueue(); /*男士队列初始化*/ Fdancers=InitQueue(); /*女士队列初始化*/ for(i=0;i { p=dancer[i]; if(strcmp(p.sex, "f ")==0) EnQueue(Fdancers,p); /*排入女队*/ else EnQueue(Mdancers,p); /*排入男队*/ } printf( "\nThe dancing partners are:\n "); while(!QueueEmpty(Fdancers)&!QueueEmpty(Mdancers)) { /*依次输入男女舞伴名*/ count++; p=DeQueue(Fdancers); /*女士出队*/ printf( "%s\t ",p.name); /*打印出队女士名*/ p=DeQueue(Mdancers); /*男士出队*/ printf( "%s\n ",p.name); /*打印出队男士名*/ } if(!QueueEmpty(Fdancers)) /*输出女士剩余人数及队头女士的名字*/ { printf( "\n There are %d women waiting for the next round.\n ",num-2*count); p=DeQueue(Fdancers); printf( "%s will be the first to get a partner. \n ",p.name); printf( "\n "); } if(!QueueEmpty(Mdancers)) /*输出男队剩余人数及队头者名字*/ { printf( "\n There are %d men waiting for the next round.\n ",num-2*count); p=DeQueue(Mdancers); printf( "%s will be the first to get a partner. \n ",p.name); printf( "\n "); } } int GetDancersInfo(Person dancer[]) { int count=0; Person p; while(1) { printf( "Input the sex:\n "); scanf( "%s ",p.sex); if(strcmp(p.sex, "0 ")==0) break; printf( "Input the name:\n "); scanf( "%s ",p.name); dancer[count]=p; count++; } return count; } void main() { int DancersNum; Person Dancers[MaxNumber]; DancersNum=GetDancersInfo(Dancers); if(DancersNum!=0) DancePartner(Dancers,DancersNum); getch(); }

以下为关联文档:

雅思阅读段落配对题答疑命题人一般是从段落中挑出一句(多数情况)或者几句(少数情况)话,进行改写(即paraphrase),然后打乱次序就变成了这种题目。换句话说,这种题型不遵循顺序原则,考察的是学生到原文找出指定...

我的舞伴做为一位幼儿教师能从幼儿的细小动作来体察幼儿的心理、了解孩子的心理活动,当老师带孩子午间散步时发现玮玮喜欢牵着她的手,于是就以舞伴的身份激发孩子的参与舞蹈的意识,虽然...

推荐阅读
图文推荐