添加 '1.c'

Signed-off-by: xtaodada <xtao@xtaolink.cn>
This commit is contained in:
xtaodada 2022-03-06 02:05:17 -05:00
parent fd76e71530
commit 4bef6527e5

93
1.c Normal file
View File

@ -0,0 +1,93 @@
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#define MAX 100
#define MAX_1 100
typedef struct singer{
int num;
char name[10];
char xb[10];
int score[MAX_1];
}SING;
void inarray(SING sing[MAX], int *pnum){
int n=0;
printf("输入歌手人数:");
scanf("%d", &n);
printf("请输入%d个歌手的信息\n",n);
printf("序号\t姓名\t性别\n");
for(int i=0;i<n;i++){
scanf("%d%s%s",&sing[i].num,sing[i].name,sing[i].xb);
}
*pnum = n;
}
void outarrry(SING sing[MAX], int n){
printf("序号\t姓名\t性别\n");
for(int i=0;i<n;i++){
printf("%d\t%s\t%s\n",sing[i].num,sing[i].name,sing[i].xb);
}
}
void insert(SING sing[MAX], int *pnum){
int n=*pnum;
printf("请输入第%d个歌手的信息\n",n);
printf("序号\t姓名\t性别\n");
scanf("%d%s%s",&sing[n].num,sing[n].name,sing[n].xb);
*pnum=n+1;
}
int search_num(SING sing[MAX], int num, int x){
}
int main(){
SING sing[MAX];
int num=0;
int choice;
while(1){
// 1.菜单
printf("\t1.输入歌手信息\n");
printf("\t2.输出歌手信息\n");
printf("\t3.新增一个歌手\n");
printf("\t4.查找歌手信息\n");
printf("\t5.修改歌手信息\n");
printf("\t6.删除歌手信息\n");
printf("\t7.评委评分\n");
printf("\t8.输出歌手成绩\n");
printf("\t9.保存歌手信息\n");
printf("\t10.加载歌手信息\n");
printf("\t0.退出\n");
// 2.输入
scanf("%d", &choice);
// 3.退出
if(choice==0) break;
// 4.调用子函数功能
switch (choice) {
case 1:
inarray(sing,&num);
break;
case 2:
outarrry(sing,num);
break;
case 3:
insert(sing,&num);
break;
case 9:
save(sing,num);
break;
case
default:
printf("调用输入错误函数\n");
break;
}
// 5.清屏
printf("按任意键继续...\n");
getch();
system("cls");
}
printf("感谢使用,再见!\n");
return 0;
}