#include”stdafx.h”#includestdio.htypedefstructstu{intnumber;charname[4];floatlen1,len2,len3;floatscore;}student;voidmain(){studentstu[10];inti,flag;floatave[3],sum[3]={0,0,0},max=0;printf(“请输入十二个同学的之所以音讯:”卡塔尔(英语:State of Qatar);for(i=0;i10;i++卡塔尔{scanf(“%d%s%f%f%f”,stu[i].number,stu[i].name,stu[i].len1,stu[i].len2,stu[i].len3);stu[i].score=stu[i].len1+stu[i].len2+stu[i].len3;if(stu[i].score=max){max=stu[i].score;flag=i;}sum[0]+=stu[i].len1;sum[1]+=stu[i].len2;sum[2]+=stu[i].len3;}for(i=0;i3;i++)ave[i]=sum[i]/3;printf(“三门课的平均战表分别为”卡塔尔国;for(i=0;i3;i++卡塔尔国printf(“%6.2f”,ave[i]);printf(“n最高分是:%d%s%6.2f%6.2f%6.2f”,stu[flag].number,stu[flag].name,stu[flag].len1,stu[flag].len1,stu[flag].len2,stu[flag].len3);}

大神,笔者那代码复制好了,能帮笔者改改吗?
#include
#include
#include
static int stnum;
char hint[80]=”请按提示输入!”;
struct Score
{
double yuwen,math,english,tiyu,sum;
};
struct Student
{
char num[10],name[20],sex[10];
int age;

struct Score score;
}stu[5];
void sethint(const char s)
{
strcpy;
}
void printline()
{
int i;
for(i=0;i<80;i++)
putchar;
}
void printtitle(const char
title)
{
int i;
int length=strlen;
putchar;
for(i=0;i<(80-2-length)/2;i++)
putchar;
printf(“%s”,title);
for(i=i+length-1;i<=80-4;i++)
putchar;
putchar;
}
void menu()
{
printline();
printtitle(“学子战表管理连串”卡塔尔国;
printline();
printtitle(“输入指令,施行相应操作”卡塔尔(英语:State of Qatar);
printtitle(“1.学子音信的录入 2.学员消息的询问”卡塔尔(قطر‎;
printtitle(“3.学员消息的删减 4.学子音信的排序”卡塔尔国;
printtitle(“5.学子音信的修正 6.学子音信的保留”卡塔尔国;
printtitle(“7.学子新闻的来得 8.退出系统”卡塔尔国;
printline();
printtitle;
printline();
}
void modelmenu(const char *s)
{
C语言改为带表头的链表的形式输入和处理数据,拜托了home88一必发。printline();
printtitle;
printline();
}
void input()
{
int i=0; char l; system;
modelmenu;
i=stnum;
printf(“已经输入了%d个学子的新闻!”,i++);
printf(“n输入第%d个学子学号:”,i卡塔尔国;
scanf(“%s”,stu[i].num); getchar();
printf(“n输入第%d个学生姓名:”,i卡塔尔(قطر‎;
scanf(“%s”,stu[i].name); getchar();
printf(“n输入第%d个学子性别:”,i卡塔尔国;
scanf(“%s”,stu[i].sex); getchar();
printf(“n输入第%d个学子年龄:”,i卡塔尔;
scanf(“%d”,&stu[i].age); getchar();
printf(“n输入第%d个学生语文战绩:”,i卡塔尔(英语:State of Qatar);
scanf(“%lf”,&stu[i].score.yuwen); getchar();
printf(“n输入第%d个学生数学成绩:”,i卡塔尔国;
scanf(“%lf”,&stu[i].score.math); getchar();
printf(“n输入第%d个学生Lithuania语战绩:”,i卡塔尔;
scanf(“%lf”,&stu[i].score.english); getchar();
printf(“n输入第%d个学生体育成就:”,i卡塔尔(英语:State of Qatar);
scanf(“%lf”,&stu[i].score.tiyu); getchar();
stu[i].score.sum+=stu[i].score.yuwen+stu[i].score.math+
stu[i].score.english+stu[i].score.tiyu;
printf(“%st%st%st%dt%.1ft%.1ft%.1ft%.1ft%.1fn”,
stu[i].num,stu[i].name,stu[i].sex,stu[i].score.yuwen,stu[i].score.math,
stu[i].score.english,stu[i].score.tiyu,stu[i].score.sum);
stnum++;
printf(“是还是不是三番陆遍输入?;
scanf(“%c”,&l);
if(l==’n’||l==’N’)
return;
else if(l==’Y’||l==’y’)
{
system;
input();
}
}
void search()
{
int i=0,flag=1;
char str[20],l; system;
modelmenu;
printf(“请输入要探索的学生学号:”卡塔尔;
scanf; getchar();
for(i=0;i if((strcmp(str,stu[i].num))==0)
{
printf(“%st%st%st%dt%.1ft%.1ft%.1ft%.1ft%.1fn”,
stu[i].num,stu[i].name,stu[i].sex,stu[i].score.yuwen,stu[i].score.math,
stu[i].score.english,stu[i].score.tiyu,stu[i].score.sum);
flag=0;
}
if
printf(“无此学号!n”);
printf(“是不是继续查询?;
scanf(“%c”,&l);
if(l==’n’||l==’N’)
return;
else
system;
}
void del()
{
int i,j,flag=1;
char str[20],l; system;
modelmenu;
printf(“请输入要去除的学子学号:”卡塔尔国;
scanf; getchar();
for(i=0;i if((strcmp(str,stu[i].num))==0)
{
printf(“%st%st%st%dt%.1ft%.1ft%.1ft%.1ft%.1fn”,
stu[i].num,stu[i].name,stu[i].sex,stu[i].score.yuwen,stu[i].score.math,
stu[i].score.english,stu[i].score.tiyu,stu[i].score.sum);
for(j=i;j stu[j]=stu[j+1];
flag=0;
printf(“删除成功!n”);
stnum–;
}
if
printf(“未有这些学子!n”);
printf(“是还是不是接二连三删除?;
scanf(“%c”,&l);
if(l==’n’||l==’N’)
return;
else
{
system;
del();
}
}
void modi()
{
int i=0,flag=1;
char str[20],l; system;
modelmenu;
printf(“请输入要修改的上学的小孩子学号:”卡塔尔(英语:State of Qatar);
scanf; getchar();
for(i=0;i if((strcmp(str,stu[i].num))==0)
break;
if
{
printline();
printf(“%st%st%st%dt%.1ft%.1ft%.1ft%.1ft%.1fn”,
stu[i].num,stu[i].name,stu[i].sex,stu[i].score.yuwen,stu[i].score.math,
stu[i].score.english,stu[i].score.tiyu,stu[i].score.sum);
printline();
printf(“n请输入修正内容n”);
printf(“请改革学生学号”卡塔尔;
scanf(“%s”,stu[i].num); getchar();
printf(“请校勘学子姓名”卡塔尔国;
scanf(“%s”,stu[i].name); getchar();
printf(“请修改学子性别”卡塔尔国;
scanf(“%s”,stu[i].sex); getchar();
printf(“请纠正学子年龄”卡塔尔(قطر‎;
scanf(“%d”,&stu[i].age); getchar();
printf(“请校订学子语文成绩”卡塔尔(英语:State of Qatar);
scanf(“%lf”,&stu[i].score.yuwen); getchar();
printf(“请改正学子数学成就”卡塔尔(قطر‎;
scanf(“%lf”,&stu[i].score.math); getchar();
printf(“请校勘学子Hungary语成绩”卡塔尔;
scanf(“%lf”,&stu[i].score.english); getchar();
printf(“请改革学子体育成就”卡塔尔国;
scanf(“%lf”,&stu[i].score.tiyu); getchar();
printf(“改善后的上学的小孩子消息为:n”);
printline();
printf(“%st%st%st%dt%.1ft%.1ft%.1ft%.1ft%.1fn”,
stu[i].num,stu[i].name,stu[i].sex,stu[i].score.yuwen,stu[i].score.math,
stu[i].score.english,stu[i].score.tiyu,stu[i].score.sum);
printline();
}
else
printf(“未有这么些学子!n”);
printf(“是不是一而再接二连三修正?;
scanf(“%c”,&l);
if(l==’n’||l==’N’)
return;
else
{
system;
modi();
}
}
void sort()
{
struct Student t;
int i,k,p,x,flag=1;
double sum[5],g;
system;
sethint;
menu();
for(i=0;i sum[i]=stu[i].score.yuwen+stu[i].score.math+
stu[i].score.english+stu[i].score.tiyu;
for(k=0;k {
x=k;
for(p=k+1;p if(sum[x]>sum[p])
{
x=p;
g=sum[k]; sum[k]=sum[x]; sum[x]=g;
t=stu[k]; stu[k]=stu[x]; stu[x]=t;
}
}
}
void save()
{
FILE *fp; int i;
fp=fopen(“c:student.txt”,”w”);
system; sethint;
menu();
fprintf(fp,”学号t姓名t性别t年龄t语文t数学t英语t体育t总分n”);
for(i=5;i>0;i–)
if(stu[i].age!=0)
fprintf(fp,”%st%st%st%dt%.1ft%.1ft%.1ft%.1ft%.1fn”,
stu[i].num,stu[i].name,stu[i].sex,stu[i].score.yuwen,stu[i].score.math,
stu[i].score.english,stu[i].score.tiyu,stu[i].score.sum);
fclose;
}
void print()
{
int i; system;
modelmenu(“展现整个学员的音信”卡塔尔(قطر‎;
printf(“学号t姓名t性别t年龄t语文t数学t英语t体育t总分n”);
for(i=5;i>0;i–)
if(stu[i].age!=0)
printf(“%st%st%st%dt%.1ft%.1ft%.1ft%.1ft%.1fn”,
stu[i].num,stu[i].name,stu[i].sex,stu[i].score.yuwen,stu[i].score.math,
stu[i].score.english,stu[i].score.tiyu,stu[i].score.sum);
while
{
char l;
printf(“是还是不是重返主菜单?;
scanf(“%c”,&l); getchar();
if(l==’Y’||l==’y’)
return;
}
}
void main()
{
int as; system(“color f5”);
do
{
menu();
printf(“Input>”);
sethint(“请按提醒输入!”);
scanf(“%d”,&as); getchar();
if
as=0;
switch
{
case 0: sethint(“输入错误,请重新输入!”); break;
case 1: input(); break;
case 2: search(); break;
case 3: del(); break;
case 4: sort(); break;
case 5: modi(); break;
case 6: save(); break;
case 7: print(); break;
case 8: break;
default:menu();
}
system;
}
while;
}
home88一必发 1**

相关文章