C语言程序设计-基于链表的学生成绩管理系统
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
精心整理华北科技学院计算机系综合性实验
实验报告
课程名称 C语言程序设计
实验学期 2011 至 2012 学年第二学期
实验报告须知
1、学生上交实验报告时,必须为打印稿(A4纸)。
页面空间不够,可以顺延。
2、学生应该填写的内容包括:封面相关栏目、实验地点、时间、目的、设备环境、
内容、结果及分析等。
《C语言程序设计》课程综合性实验报告开课实验室:基础五 2012年7月 6 日
struct xs *init()
{
struct xs* hd;
hd=(struct xs *)malloc(sizeof(struct xs));
hd->next=NULL;
return hd;
}
void fr(struct xs *hd)
{
struct xs *p;
p=hd->next;
while(hd->next!=NULL)
{
printf(" 学号:");
scanf("%d",&xh);
printf(" 姓名:");
scanf("%s",xm);
printf(" 高数:");
scanf("%d",&gs);
printf(" 英语:");
scanf("%d",&yy);
printf(" 物理:");
scanf("%d",&wl);
p=(struct xs *)malloc(sizeof(struct xs));
p->xh=xh;
strcpy(p->xm,xm);
p->gs=gs;
fprintf(fp,"%3d\n",num);
for(i=0;i<num;i++)
{
fprintf(fp,"%3d %12s %3d %3d %3d\n",p->xh,p->xm,p->gs,p ->yy,p->wl);
p=p->next;
}
fclose(fp);
printf("\n 保存文件完毕,请按任意键继续!\n ");
getch();
}
else
{
fscanf(fp,"%3d %12s %3d %3d %3d\n",p->xh,p->xm,p->gs,p->y y,p->wl);
p->next=hd->next;
hd->next=p;
}
fclose(fp);
printf("\n 读取文件完毕,请按任意键继续!\n ");
getch();
}
void print(struct xs *hd)
{
struct xs*p;
p=hd->next;
}
printf("**********************************************\n");
printf(" 链表显示完毕,请按任意键继续!\n");
getch();
}
else
printf("\n 当前链表为空,请先读取文件或创建链表!\n
按任意键继续!\n ");
}
void menu()
{
system("cls");
printf(" ****************************************\n");
printf(" * 学生成绩管理系统(1.0) *\n");
head=init();
while(xz!=5)
{
menu();
scanf("%d",&xz);
switch(xz)
{
case 1:
create(head);
break;
case 2:
print(head);
break;
case 3:
fr(head);
free(head);
}。