添加 '2.c'

This commit is contained in:
xtaodada 2022-03-06 03:38:36 -05:00
parent f91f23fa48
commit bf2da24a6d

143
2.c Normal file
View File

@ -0,0 +1,143 @@
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#define max 100
typedef struct student{
int numb;
char name[10];
int score[3];
float ave;
}STU;
int main()
{
STU stu[max];
int num=0;
int choice;
for(;;){
//1
printf("1.输入歌手信息\n");
printf("2.显示歌手信息\n");
printf("3.新增一个歌手\n");
printf("4.查找歌手信息\n");
printf("5.修改歌手信息\n");
printf("6.删除歌手信息\n");
printf("7.评委评分\n");
printf("8.输入歌手成绩\n");
printf("9.保存歌手信息\n");
printf("10.加载歌手信息\n");
printf("11.退出\n");
//2
printf("请选择");
scanf("%d",&choice);
//3
if(choice==0) break;
//4
switch(choice){
case 1: printf("功能1调用\n");
break;
case 2: printf("功能2调用\n");
break;
case 4: find(sing,num);
break;
case 5: amend(sing,*num);
break;
case 6: remove(sin,*num);
break;
//5
printf("请按任意键继续...");
getch();
system("cls");
}
printf("感谢使用,再见\n");
return 0;
}
void find(SING sing[MAx],int n){
printf("请选择查找方式\n");
int x;
while(1){
printf("\t1.序号查找\n");
printf("\t2.姓名查找\n");
printf("\to.退出\n);
scanf("%d",&x);
if(x==0) break;
switch(x){
case 1:
xuhao(sing[n],num,num_);
break;
case 2:
xingming(sing[n].name);
break;
}
printf("按任意键继续...\n")
getch();
system("cls");
}
return 0;
}
void xuhao(SING sing,int num,int num_){
int x;
printf("请输入需要查找的序号: x\n");
scanf("%d",&x);
printf("序号\t姓名\t性别\t平均分\t原始成绩\n");
printf("%d\t%s\t%s\t%.2f",sing[x].num,sing[x].name,sing[x].xb,sing[x].aver);
for(int j=0;j<n_;j++){
printf("\t%d",sing[i].score[j]);
}
printf("\n");
}
void xingming(int sing[n].num){
int x;
printf("请输入需要查找的姓名: x\n");
scanf("%S",&x);
printf("序号\t姓名\t性别\t平均分\t原始成绩\n");
printf("%d\t%s\t%s\t%.2f",sing[x].num,sing[x].name,sing[x].xb,sing[x].aver);
for(int j=0;j<n_;j++){
printf("\t%d",sing[i].score[j]);
}
printf("\n");
}
void amend(SING sing[MAX],int *pnum){
int n;
printf("请输入需要修改的歌手信息 : n\n”);
scanf("%d",&n);
printf("序号\t姓名\t性别\n");
scanf("%d%s%s",&sing[n].num,sing[n].name,sing[n].xb);
}
void remove(SING sing[MAX],int *pnum){
int n=*pnum;
int x;
printf("请输入需要删除的歌手序号x\n");
scanf("%d",&x);
for(x;x<n;x++)
*pnum=n-1;
}