资源描述:
《学生信息管理系统C语言源代码》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、#include#include#include#includestructstuType{charname[9];//姓名chargender[3];//性别intage;//年龄charphone[11];//手机号intstature;//身高}stud[100];//;不可少/**********************************************/voidGotoXY(intx,inty);voidshuru();voidzhuye();voidchaxun();voidchaxun
2、sx();voidchaxun_name();voidchaxunlb();voidchaxunxm1();voidchaxunxm2();voiddisplist();voidchange();voidsort();voidsort_age();voidsort_stature();voidstatistics();/************************************************/voidmain()//主函数{zhuye();//系统首页}/************************************************/voidGot
3、oXY(intx,inty)//坐标定位函数{COORDc;c.X=x-1;c.Y=y-1;SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),c);}/*******************控制输入的函数*****************************/voidshuru(){intgdok;intnmOk;intageok;intstok;charkeypress;FILE*fp;if((fp=fopen("stuType","a"))==NULL){printf("cannotopenfile");retur
4、n;}GotoXY(30,3);printf("请顺序输入各项信息");GotoXY(5,4);printf("===================================================================");GotoXY(5,6);printf("姓名:性别:年龄:手机号码:身高(cm):");for(inti=0;i<100;i++){nmOk=false;while(!nmOk){GotoXY(10,6);scanf("%s",stud[i].name);if(stud[i].name==' '){GotoXY(10,8);printf("
5、名字不能为空,按任意键继续...");GotoXY(10,8);printf("");getche();GotoXY(10,8);printf("");}else{nmOk=true;}}gdok=false;while(!gdok){GotoXY(25,6);scanf("%s",stud[i].gender);if(stud[i].gender==' '){GotoXY(10,9);printf("性别不能为空,按任意键继续...");GotoXY(10,9);printf("");getche();GotoXY(10,9);printf("");}else{gdok=true;}}
6、ageok=false;while(!ageok){GotoXY(34,6);printf("");GotoXY(34,6);scanf("%d",&stud[i].age);if(stud[i].age>100
7、
8、stud[i].age<0){GotoXY(10,9);printf("年龄必须为0到100的整数,按任意键继续...");getche();GotoXY(10,9);printf("");}else{ageok=true;}}GotoXY(47,6);scanf("%s",stud[i].phone);stok=false;while(!stok){GotoXY(71,6);
9、printf("");GotoXY(71,6);scanf("%d",&stud[i].stature);if(stud[i].stature>230
10、
11、stud[i].stature<50){GotoXY(10,9);printf("身高必须为50到230的数,按任意键继续...");getche();GotoXY(10,9);printf("");}else{stok=true;}}if(fwrite(&stud[i