全文预览

C语言课程设计报告-学生选课系统

上传者:相惜 |  格式:doc  |  页数:15 |  大小:133KB

文档介绍
生可按学分查询,可查询任一学分包含的所有课程。当执行此程序时显示屏上输出运算结果(见图1-5所示)。Р请输入要查询的学分:Р30Р0,chinese,wenke,40,10,30,30,1РPress any key to exit!Р 图1-5Р2.2.4.2查询程序代码Рstruct Student /*结构体声明*/Р{Р int num;Р char name[20];Р char type[20];Р int sumtime;Р int teachtime;Р int practisetime;Р int score;Р int term;Р} score[10];Р int function4()Р {Р struct Student score[10]={{0,"chinese","wenke",40,10,30,30,1},Р {1,"maths","like",60,60,0,60,1},Р {2,"english","wenke",50,50,0,50,1}};Р int i,n;Р for(i=0;i<10;i++)Р {Р printf("请输入要查询的学分:");Р scanf("%d",&n);Р if(score[i].score==n);Р printf("%5d%9s%9s%5d%5d%5d%5d%5d",score[i].num,score[i].name,score[i].type,score[i].sumtime,score[i].teachtime,score[i].practisetime,score[i].score,score[i].term);Р exit(1);Р }Р }Р 2.2.4.3查询程序实现提示:Р(1)声明一个结构体类型,并不意味系统将分配一段内存空间来存放各数据项成员。Р(2)运行时只需输入要查询学分即可。

收藏

分享

举报
下载此文档