现在期末有个课程设计做了这些完成不来
大虾帮帮小弟,小弟谢万分啊!!
题目是这样的:
用链表实现学生成绩管理系统
[glow=233,#65ccff,3]要求:1。能录入学生各科成绩;
2。能查询学生各科成绩;
3。能修改学生各科成绩;
4。删除学生成绩;
5。退出程序。[/glow]
[glow=255,red,3]你们不要笑我,我太差,我知道你们觉得这题太简单,所以好心人帮帮我啊[/glow]~~~~~
#include"stdlib.h" #include"stdio.h" struct stud {char name[20]; long num; int age; char sex; float score; struct stud *next; }; struct stud *head, *this, *new; main() { char ch; int flag=1; head=NULL; printf("***************************************************************\n"); printf("| welcome to use ! |\n"); printf("| |\n"); printf("| All rights resevered 03101 Huang wenmin |\n"); printf("*********~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~**********\n"); while(flag) {printf("\ntype'E'or'e'to enter new record,"); printf("\ntype'L'or'l'to list all records:"); ch=getchar();getchar(); switch(ch) { case'e': case'E':new_record();break; case'l': case'L':listall();break; default:flag=0; } } } new_record(void) { char numstr[20]; new=(struct stud *) malloc (sizeof (struct stud)); if(head==NULL) head=new; else {this=head; while (this->next!=NULL) this=this->next; this->next=new; } this=new; printf("\nenter name:"); gets(this->name); printf("\nenter number:"); gets(numstr); this->num=atol(numstr); printf("\nenter age:"); gets(numstr); this->age=atoi(numstr); printf("\nenter sex:"); this->sex=getchar();getchar(); printf("\nenter score:"); gets (numstr); this->score=atof(numstr); this->next=NULL; } listall(void) {int i=0; if(head==NULL) {printf("\nempty list. \n");return;} this=head; do{ printf("\nrecord number %d\n",++i); printf("name:%s\n",this->name); printf("num:%ld\n",this->num); printf("age:%d\n",this->age); printf("sex:%c\n",this->sex); printf("score:%6.2f\n",this->score); this=this->next; } while(this!=NULL); }