diff --git a/第七题.cpp b/第七题.cpp new file mode 100644 index 0000000..c5d083b --- /dev/null +++ b/第七题.cpp @@ -0,0 +1,175 @@ +#include +#include +#include +#include +void a1(); +void a2(); +void a3(); +void a4(); +void a5(); +void menu(); +int sum=7; +struct stu +{ + int Id; + int clas; + char name[100]; + float score1; + float score2; + float score3; + float score; +}stu[100]={{10001,11,"Zhang",99.5,88.5,89.5,277.5}, +{10002,12,"Yang",77.9,56.5,87.5,221.9}, +{10003,11,"Liang",92.5,99.0,60.5,252}, +{10004,11,"Cai",89.6,56.9,90.5}, +{10005,14,"Fu",55.6,67.9,98.9}, +{10006,12,"Mao",22.1,45.9,99.2}, +{10007,13,"Zhan",35.6,67.9,88.0}}; +int main() +{ + while(1) + { + menu(); + } +} +void menu() +{ + int t; + scanf("%d",&t); + switch(t) + { + case 1:a1();break; + case 2:a2();break; + case 3:a3();break; + case 4:a4();break; + case 5:a5();break; + } +} +void a1() +{ + char b[1000]; + int x1=0,x2=0,len,i=0; + gets(b); + len=strlen(b); + while(b[i]!='-') + { + i=i+1; + } + for(int j=1;ja)printf("%d %d %s %.1f %.1f %.1f\n",stu[i].Id,stu[i].clas,stu[i].name,stu[i].score1,stu[i].score2,stu[i].score3); + } +} +void a5() +{ + char b[1000]; + int x1=0,x2=0,x3=0,len,t,i=0; + gets(b); + len=strlen(b); + while(b[i]!='.') + { + i=i+1; + } + t=i+1; + for(int j=1;j