c语言学生信息管理系统.doc





《c语言学生信息管理系统.doc》由会员分享,可在线阅读,更多相关《c语言学生信息管理系统.doc(46页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、优质文本#include#include#include#define MAX_S_NUM 100;struct stuTypechar name9;char gender3;char phone12;int age;float hight; struct stuType stuAry100;struct stuType Ary100;int n;FILE *fp;char ch;bool test=true;void GotoXY(int x,int y); void mainColumName();void DispColumName();void QueryColumName();voi
2、d QueryDispColumName();void QueryDispColumName1();void QueryName();void QueryName1();void QueryList();void DispErrorInfo();void ClDispInfo();void ClearInfo();void QuClearInfo();void ScanfInfo(stuType stu);void Input();void Query();void SortAry();void Modification();void statitics();/*主函数*/void main(
3、) while (test)/*ystem(cls);GotoXY(30,10); printf(同学通讯录管理系统顺序结构查询n); GotoXY(29,11); printf(=n); GotoXY(29,13); printf(1. 输入 2. 查询 3. 修改n); GotoXY(29,15); printf(4. 排序 5. 统计 6. 退出n); GotoXY(29,17); printf(=n); GotoXY(29,19); printf(请选择:); /getch();scanf(%d,&n); */mainColumName();if(n6)GotoXY(40,19);pr
4、intf(输入无此选项); test=!test; switch(n)case 1 :/system(cls);DispColumName(); Input();test=!test; break;case 2 : /system(cls);QueryColumName(); Query();test=!test; break;case 3 : /system(cls);Modification(); test=!test; break;case 4 :SortAry();test=!test; break;case 5 :statitics();test=!test; break;case
5、6 : system(cls); test=false; break;/*坐标定位*/void GotoXY(int x,int y)COORD c;c.X = x - 1;c.Y = y - 1;SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), c);/*输入显示模块*/void DispColumName()system(cls);GotoXY(30,10);printf(请输入各项信息n);GotoXY(25,11);printf(=n); GotoXY(2,13);printf(姓名:);GotoXY(20,13);pr
6、intf(性别:);GotoXY(33,13);printf( 号:);GotoXY(55,13);printf(年龄:);GotoXY(65,13);printf(身高(m):);GotoXY(15,15);printf(是否继续输入(Y/*):);/*输入显示*/void Input()int i=0;bool a=true;/int num;fp = fopen (stu.dat, a);if (fp=NULL)printf(The file stu.datis opened filed);exit(1);int count=0;while(a)ScanfInfo(stuAry);Got
7、oXY(35,15);/scanf(%s,&ch);fflush(stdin);Arycount=stuAryi;fwrite(&stuAryi,sizeof(struct stuType), 1, fp); count+;ch = getchar();if(ch=Y|ch=y) / fwrite(&stuAryi,sizeof(struct stuType), 1, fp); / Arycount=stuAryi; / count+; / fclose(fp); ClearInfo(); DispColumName();else a=false; test=!test;/mainColumN
8、ame();count=count-1; fclose(fp);/*查询模块方式*/void Query()int m;GotoXY(11,9);scanf(%d,&m);fflush(stdin);switch (m)case 1 : QueryDispColumName(); QueryDispColumName1(); break; case 2 :QueryName();QueryName1(); break;case 3 :QueryList(); break;case 0 : /system(cls);test=!test; break;/*修改模块方式*/void Modific
9、ation()int m = 0;int i = 0;int count = 0;int b = 0;char ch ,search9;bool a=true;system(cls);GotoXY(30,6);printf(修改信息);GotoXY(10,7);printf(=);GotoXY(10,9);printf(=);GotoXY(13,8);printf(请输入要修改人姓名:);while (a) GotoXY(33,8); scanf(%s,search); fflush(stdin); fp = fopen(stu.dat,r); if (fp=NULL) printf(The
10、file stu.dat is opened filed!); exit(1); while(!feof(fp)fread(&Arycount,sizeof(struct stuType),1,fp);count+; fclose(fp);/while (a)/rewind(fp);/ while (!feof(fp)char *ch1=Aryi.name ,*ch2=search;for(i=0;icount;i+) /fread(&Arym,sizeof(struct stuType),1,fp); /char *ch1=Aryi.name ,*ch2=search; if (strcmp
11、(Aryi.name,search)=0) GotoXY(2,13); printf(姓名:); GotoXY(20,13); printf(性别:); GotoXY(33,13); printf( 号:); GotoXY(55,13); printf(年龄:); GotoXY(65,13); printf(身高(m):); GotoXY(8,13); scanf(%s,stuAryi.name); fflush(stdin); GotoXY(26,13); scanf(%s,stuAryi.gender);fflush(stdin); GotoXY(42,13); scanf(%s,stuA
12、ryi.phone); while(strlen(stuAryi.phone)!=11) DispErrorInfo(); GotoXY(25,19); printf( 号码输入错误,应为11为数字!); GotoXY(42,13); printf( ); GotoXY(42,13); scanf(%s,&stuAryi.phone); fflush(stdin); ClDispInfo(); GotoXY(25,19); printf( ); GotoXY(61,13); scanf(%d,&stuAryi.age); while(stuAryi.age120) DispErrorInfo(
13、); GotoXY(25,19); printf(年龄输入应在0-120之内); GotoXY(61,13); printf( ); GotoXY(61,13); scanf(%d,&stuAryi.age); fflush(stdin); ClDispInfo(); GotoXY(25,19); printf( ); GotoXY(75,13); scanf(%f,&stuAryi.hight); while (stuAryi.hight3) DispErrorInfo(); GotoXY(25,19); printf(身高应在0-3米之内);GotoXY(75,13); printf( )
14、; GotoXY(75,13); scanf(%f,&stuAryi.hight); fflush(stdin); Aryi=stuAryi;b+;/fwrite(&Aryi,sizeof(struct stuType), 1, fp); / fclose(fp); /count+;/fclose(fp); count=count-1;fp = fopen(stu.dat,w); for(i=0;icount;i+) fwrite(&Aryi,sizeof(struct stuType),1,fp); fclose(fp); if(b=0)GotoXY(37,8);printf(没有此项);
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 语言 学生 信息管理 系统

限制150内