《C程序设计综合实习[软]》实习报告封面及正文格式.doc
文本预览下载声明
《程序设计综合实习[软]》
实 习 报 告
学 号 139074180 姓 名 陈亮 班 级 软132 指导教师
安徽工业大学
2014年月四、系统功能模块图
程序流程图或算法
六、源程序及运行结果(屏幕截图)
#includestdio.h
#includestdlib.h
#includestring.h
//结构体
struct stud_node
{
char name[20];
int num;
int chinese;
int math;
int english;
int A_score;
struct stud_node *next;
};
//加载
struct stud_node *load()
{
FILE *fp=NULL;
struct stud_node *head,*p,*tail;
int size = sizeof(struct stud_node);
head=tail=NULL;
if((fp=fopen(e:\\1.dat,rb))==NULL)
{
fp=fopen(e:\\1.dat,w);
fclose(fp);
return head;
}
while(!feof(fp))
{
p=(struct stud_node *)malloc(size);
if(fread(p,sizeof(struct stud_node),1,fp)!=1)
{
break;
}
p-next=NULL;
if(head==NULL)
head=p;
else
tail-next=p;
tail=p;
}
fclose(fp);
return head;
}
//新建链表方法的代码块
struct stud_node *Create_Stu_Doc()
{
struct stud_node *head,*p,*tail;
int num;
char name[20];
int chinese;
int math;
int english;
int A_score;
int size = sizeof(struct stud_node);
head=tail=NULL;
scanf(%d, num);
while(num!=0)
{
scanf(%s%d%d%d,name,chinese,math,english);
A_score=chinese+math+english;
p=(struct stud_node *)malloc(size);
strcpy(p-name,name);
p-num=num;
p-chinese=chinese;
p-math=math;
p-english=english;
p-A_score=A_score;
p-next=NULL;
if(head==NULL)
head=p;
else
tail-next=p;
tail=p;
scanf(%d, num);
}
return head;
}
//打印所有学生姓名
void pri2(struct stud_node * head)
{
struct stud_node * p;
for(p=head;p!=NULL;p=p-next)
printf(%d\t\t%s\t\t%d\t%d\t%d\t%d\n,p-num,p-name,p-chinese,p-math,p-english,p-A_score);
}
//打印学生的信息----------查询部分
void pri(struct stud_node * head)
{
int xh,zf;
struct stud_node * p;
char xm[20],xz;
while(1)
{
printf(\n\n\n\n);
printf([1].按照学号查询\n);
printf([2].按照姓名查询\n);
printf([3].按照总分查询\n);
printf([4].查询所有成绩\n);
printf([0].退出查询\n);
printf(请输入要查询的方式:\n);
scanf(%c,xz);
getchar();
switch(xz)
{
case 1:
{
printf(请输入学号:);
scanf(%d,xh);
get
显示全部