You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.3 KiB
55 lines
1.3 KiB
1 year ago
|
#include "mysyslib.h"
|
||
|
|
||
|
void input(ss*stu){
|
||
1 year ago
|
char tmp[5];
|
||
1 year ago
|
do{
|
||
1 year ago
|
int pst = stu->nums;
|
||
1 year ago
|
printf("Id ");
|
||
1 year ago
|
scanf(" %s",stu->student[pst].id);
|
||
1 year ago
|
printf("\n");
|
||
1 year ago
|
|
||
1 year ago
|
printf("class ");
|
||
1 year ago
|
scanf(" %s",stu->student[pst].class);
|
||
1 year ago
|
printf("\n");
|
||
1 year ago
|
|
||
1 year ago
|
printf("name ");
|
||
1 year ago
|
scanf(" %s",stu->student[pst].name);
|
||
1 year ago
|
printf("\n");
|
||
1 year ago
|
|
||
1 year ago
|
printf("score1 ");
|
||
1 year ago
|
scanf("%lf",&stu->student[pst].score1);
|
||
1 year ago
|
printf("\n");
|
||
1 year ago
|
|
||
1 year ago
|
printf("score2 ");
|
||
1 year ago
|
scanf("%lf",&stu->student[pst].score2);
|
||
1 year ago
|
printf("\n");
|
||
1 year ago
|
|
||
1 year ago
|
printf("score3 ");
|
||
1 year ago
|
scanf("%lf",&stu->student[pst].score3);
|
||
1 year ago
|
printf("\n");
|
||
1 year ago
|
|
||
|
stu->student[pst].score = stu->student[pst].score1 + stu->student[pst].score2 + stu->student[pst].score3;
|
||
|
stu->nums++;
|
||
|
|
||
1 year ago
|
printf("continue?\n");
|
||
|
scanf("%s",tmp);
|
||
1 year ago
|
}while(!strcmp(tmp,"yes"));
|
||
1 year ago
|
|
||
|
return;
|
||
1 year ago
|
}
|
||
1 year ago
|
|
||
|
//输出相关
|
||
|
void Print(Student*student){
|
||
|
printf("%s,%s,%s,%.1lf,%.1lf,%.1lf,%.1lf\n",student->id,student->class,student->name,student->score1,student->score2,student->score3,student->score);
|
||
|
}
|
||
|
|
||
|
void allPrint(ss*stu){
|
||
|
if(stu->nums){
|
||
|
for(int i = 0; i < stu->nums; ++i){
|
||
|
Print(&stu->student[i]);
|
||
|
}
|
||
|
}else{
|
||
|
printf("No data exist\n");
|
||
|
}
|
||
|
}
|