用C语言做排考场座位的程序!要求如下:用户输入1,设定考场座位,2取消考场座位,3显示某座位考生信息;4,查找学生座位;5,显示考场座次表。
/* 标准文档模板 */#include "Stdio。h"#include "Conio。 h"#define HANG 8#define LIE 8typedef struct node{ unsigned hang; unsigned lie; char ID[20]; char name[20]; struct node *next; };unsigned cmd,count;struct node *head;char ID[20],name[20];unsigned get_cmd(){ printf("
Please input ...全部
/* 标准文档模板 */#include "Stdio。h"#include "Conio。
h"#define HANG 8#define LIE 8typedef struct node{ unsigned hang; unsigned lie; char ID[20]; char name[20]; struct node *next; };unsigned cmd,count;struct node *head;char ID[20],name[20];unsigned get_cmd(){ printf("
Please input the comand:"); scanf("%d",&cmd); printf("
"); return cmd;}void get_id(){ printf("Please input student ID:"); scanf("%s",ID); printf("
");}void get_name(){ printf("Please input student name:"); scanf("%s",name); printf("
");}void fun1(){ int h=0,l=0,i,j,f=1,f2=1; struct node *q,*p,*r; if(count==HANG*LIE) printf("The room is full!
"); else while(1) { f=1; h=rand()% HANG; l=rand()% LIE; r=head; p=head->next; if(f2) get_id(); while(p!=NULL) { if(strcmp(p->ID,ID)==0) {printf("The ID has exited!
");f=0;break;} else if((p->hang==h)&&(p->lie==l)) { f=2; f2=0; break; } else { r=p; p=p->next; } } if(f==1) { get_name(); q=(struct node*)malloc(sizeof(struct node)); r->next=q; q->hang=h; q->lie=l; strcpy(q->ID,ID); strcpy(q->name,name); q->next=NULL; count ; printf("******ADD SUCCESS!******
"); printf("ID:%s
name:%s
Position:(%d,%d)
",ID,name,h,l); break; } if(f==0) break; } }。收起