c语言程序设计-基于链表学生成绩管理系统Word文档格式.doc

上传人:b****9 文档编号:13047553 上传时间:2022-10-03 格式:DOC 页数:18 大小:85KB
下载 相关 举报
c语言程序设计-基于链表学生成绩管理系统Word文档格式.doc_第1页
第1页 / 共18页
c语言程序设计-基于链表学生成绩管理系统Word文档格式.doc_第2页
第2页 / 共18页
c语言程序设计-基于链表学生成绩管理系统Word文档格式.doc_第3页
第3页 / 共18页
c语言程序设计-基于链表学生成绩管理系统Word文档格式.doc_第4页
第4页 / 共18页
c语言程序设计-基于链表学生成绩管理系统Word文档格式.doc_第5页
第5页 / 共18页
点击查看更多>>
下载资源
资源描述

c语言程序设计-基于链表学生成绩管理系统Word文档格式.doc

《c语言程序设计-基于链表学生成绩管理系统Word文档格式.doc》由会员分享,可在线阅读,更多相关《c语言程序设计-基于链表学生成绩管理系统Word文档格式.doc(18页珍藏版)》请在冰豆网上搜索。

c语言程序设计-基于链表学生成绩管理系统Word文档格式.doc

《C语言程序设计》课程综合性实验报告

开课实验室:

基础五2012年7月6日

实验题目

基于链表的学生成绩管理系统

一、实验目的

1、掌握链表的创建、遍历显示和清除;

2、掌握链表数据的文件保存、读取;

二、设备与环境

微型计算机、VC++6.0

三、实验内容

1、定义结构体,创建链表

structxsnode

{

  intxh;

  charxm[15];

  intgs;

  intyy;

  intwl;

  structxsnode*next;

};

2、根据以上链表结点结构,实现以下功能

a、学生学号、姓名、各门成绩的录入;

b、链表数据显示及清除;

c、链表数据的文件保存与读取;

四、实验结果及分析

1、运行结果

主菜单

数据显示

2、源程序

Œ主函数

voidmain()

intxz=0;

structxs*head;

head=init();

while(xz!

=5)

{

menu();

scanf("

%d"

&

xz);

switch(xz)

{

case1:

create(head);

break;

case2:

print(head);

case3:

save(head);

case4:

read(head);

case5:

printf("

\n系统退出,拜拜!

\n"

);

default:

printf("

\n选择错误,请按任意键选择!

\n"

getch();

break;

}

}

fr(head);

free(head);

}

数据录入源代码

voidcreate(structxs*hd)

intxh,gs,yy,wl,i;

charxm[20];

structxs*p;

fr(hd);

printf("

\n请输入学生个数:

"

scanf("

num);

for(i=0;

i<

num;

i++)

{

printf("

请输入%d个学生of%d\n"

i+1,num);

学号:

scanf("

xh);

姓名:

%s"

xm);

高数:

gs);

英语:

yy);

物理:

wl);

p=(structxs*)malloc(sizeof(structxs));

p->

xh=xh;

strcpy(p->

xm,xm);

gs=gs;

yy=yy;

wl=wl;

next=hd->

next;

hd->

next=p;

}

录入数据完毕,请按任意键继续!

\n"

getch();

Ž添加记录源代码

voidprint(structxs*hd)

structxs*p;

p=hd->

if(p!

=NULL)

{

\n数据显示\n"

**********************************************\n"

学号姓名高数英语物理平均分\n"

while(p!

{

printf("

%4d"

p->

%10s"

xm);

%8d"

%7d"

%6d"

%8.2f\n"

(p->

wl+p->

wl)/3.0);

p=p->

}

链表显示完毕,请按任意键继续!

\n"

getch();

}

else

\n当前链表为空,请先读取文件或创建链表!

\n按任意键继续!

\n"

查询记录源代码

voidmenu()

system("

cls"

****************************************\n"

*学生成绩管理系统(1.0)*\n"

*jb11-131宋洁2012-7-3*\n"

*1-创建链表*\n"

*2-数据显示*\n"

*3-保存文件*\n"

*4-读取文件*\n"

*5-系统退出*\n"

请选择操作(1-5:

源程序

#include"

stdio.h"

stdlib.h"

#include<

string.h>

conio.h"

structxs

intxh;

intgs,yy,wl;

structxs*next;

intnum=0;

structxs*init()

structxs*hd;

hd=(structxs*)malloc(sizeof(structxs));

hd->

next=NULL;

returnhd;

voidfr(structxs*hd)

p=hd->

while(hd->

next!

next=p->

free(p);

voidsave(structxs*hd)

if(hd->

structxs*p=hd->

inti;

FILE*fp;

fp=fopen("

yh.txt"

"

w"

fprintf(fp,"

%3d\n"

num);

for(i=0;

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 求职职场 > 简历

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1