C语言课程设计学生学院____计算机学院_______专业班级____软件工程(2)班_____学号学生姓名____指导教师成绩_____________________2009年1月7日一、设计名称学生成绩管理查询系统二、设计内容和要求学生数据包括:学号,姓名,性别,成绩(自定3到5门课程)使用链表或结构体数组处理的方法。实现功能:添加数据删除数据查询数据修改数据对数据进行排序链表数据可以保存在文件中链表数据可从文件中读出有命令菜单提示编写的程序要求完整实现功能,用户界面友好,程序运行可靠。三、设计目的灵活使用C语言进行程序编写,巩固有关语句,指针,结构体,链表,文件操作等概念和方法。提高调试程序的技能,提高软件编写的能力。四、设计环境硬件:PC机软件:Dos,++、源程序及注释:#include<>#include<>/*动态分配内存*/#include<>#include<>#defineLENsizeof(structstudent)/*指定LEN为结构体的长度*/structstudent{longnum;/*学号*/charname[20];/*姓名*/charsex[5];/*性别*/intage;/*年龄*/floatyingyu;/*英语*/floatshuxue;/*数学*/floatyuwen;/*语文*/structstudent*next;/*连接点*/};intn,a;/*定义为全局变量*/structstudent*creat(void)/*建表函数,建立一个新的数据文件*/{structstudent*head;structstudent*p1,*p2,*p3;inti;n=0;p1=p2=p3=(structstudent*)malloc(LEN);head=p3;for(i=0;i<80;i++)printf("-");/*输出表格区域*/printf("\n");printf("Pleaseinputthedatas,orinput0tostop:\n");for(i=0;i<80;i++)printf("-");/*输出表格区域*/printf("\n");printf("thenumber:");scanf("%ld",&p1->num);if(p1->num==0){head=NULL;gotoend;}/*输入0时结束*/while(p1->num<0){printf("Error!thenumbershould>0!inputagain:\n");/*输入错误*/printf("thenumber:");scanf("%ld",&p1->num);}printf("name:");scanf("%s",p1->name);printf("sex:");scanf("%s",p1->sex);printf("age:");scanf("%d",&p1->age);while((p1->age<0)||(p1->age>100))/*防止输入错误年龄*/{printf("Error!inputtherightageagain:");scanf("%d",&p1->age);}printf("\nyingyu:");scanf("%f",&p1->yingyu);while((p1->yingyu<0)||(p1->yingyu>100))/*成绩要在0到100*/{printf("Error,thescoreshouldbetween0and100,inputagain!");scanf("%f",&p1->yingyu);}printf("shuxue:");scanf("%f",&p1->shuxue);while((p1->shuxue<0)||(p1->shuxue>100))/*成绩要在0到100*/{printf("Error,thescoreshouldbetween0and100,inputagain!");scanf("%f",&p1->shuxue);}printf("yuwen:");scanf("%f",&p1->yuwen);while((p1->yuwen<0)||(p1->yuwen>100))/*成绩要在0到100*/{printf("Error,thescoreshouldbetween0and100,inputagain!");scanf("%f",&p1->yuwen);}head=NULL;while(p1->num!=0){n=n+1;/*记录增加了一个数据*/if(n==1)head=p1;/*第一个数据作为链头*/elsep2->next
C语言实验报告(学生成绩管理系统) 来自淘豆网www.taodocs.com转载请标明出处.