更新 '1.c'

This commit is contained in:
xtaodada 2022-03-06 03:25:13 -05:00
parent c790ccf79a
commit f91f23fa48

25
1.c
View File

@ -23,11 +23,15 @@ void inarray(SING sing[MAX], int *pnum){
} }
*pnum = n; *pnum = n;
} }
void outarrry(SING sing[MAX], int n){ void outarrry(SING sing[MAX], int n, int n_){
// 输出歌手信息:序号、姓名、性别 // 输出歌手信息:序号、姓名、性别、平均分、原始成绩
printf("序号\t姓名\t性别\n"); printf("序号\t姓名\t性别\t平均分\t原始成绩\n");
for(int i=0;i<n;i++){ for(int i=0;i<n;i++){
printf("%d\t%s\t%s\n",sing[i].num,sing[i].name,sing[i].xb); printf("%d\t%s\t%s\t%.2f",sing[i].num,sing[i].name,sing[i].xb,sing[i].aver);
for(int j=0;j<n_;j++){
printf("\t%d",sing[i].score[j]);
}
printf("\n");
} }
} }
void insert(SING sing[MAX], int *pnum){ void insert(SING sing[MAX], int *pnum){
@ -152,10 +156,9 @@ int main(){
printf("\t5.修改歌手信息\n"); printf("\t5.修改歌手信息\n");
printf("\t6.删除歌手信息\n"); printf("\t6.删除歌手信息\n");
printf("\t7.排序歌手\n"); printf("\t7.排序歌手\n");
printf("\t8.评委评分\n"); printf("\t8.评委评分\n"); // 已完成
printf("\t9.输出歌手成绩\n"); printf("\t9.保存歌手信息\n"); // 已完成
printf("\t10.保存歌手信息\n"); // 已完成 printf("\t10.加载歌手信息\n"); // 已完成
printf("\t11.加载歌手信息\n"); // 已完成
printf("\t0.退出\n"); // 已完成 printf("\t0.退出\n"); // 已完成
// 2.输入 // 2.输入
@ -170,7 +173,7 @@ int main(){
inarray(sing,&num); inarray(sing,&num);
break; break;
case 2: case 2:
outarrry(sing,num); outarrry(sing,num,num_);
break; break;
case 3: case 3:
insert(sing,&num); insert(sing,&num);
@ -178,10 +181,10 @@ int main(){
case 8: case 8:
mark(sing,num,&num_); mark(sing,num,&num_);
break; break;
case 10: case 9:
save(sing,num,num_); save(sing,num,num_);
break; break;
case 11: case 10:
load(sing,&num,&num_); load(sing,&num,&num_);
break; break;
default: default: