diff --git a/6.exe b/6.exe deleted file mode 100644 index ca7ee40..0000000 Binary files a/6.exe and /dev/null differ diff --git a/7(1).c b/7(1).c new file mode 100644 index 0000000..5d2c163 --- /dev/null +++ b/7(1).c @@ -0,0 +1,391 @@ +#include +#include +#include +struct student +{ +char num[20];char name[20];char id[10];char sex[4];int age;char tele[15]; +}student[500],student1; + +void menu(); +void type_in(); +void baocun(int); +void scan(); +void del(); +void search(); +void search_name(); +void change(); +void add(); + +void menu() +{ +printf("\n"); +printf(" 1.录入学生信息\n"); +printf(" 2.浏览学生信息\n"); +printf(" 3.查询学生信息\n"); +printf(" 4.删除学生信息\n"); +printf(" 5.修改学生信息\n"); +printf(" 6.添加学生信息\n"); +printf(" 7.退出\n"); +printf("\n"); + +} +/********************************************************************************************/ +int main() +{ + int n,f; + while(1) + { + do + { + menu(); + printf("请输入你需要操作的序号(1-7):\n"); + scanf("%d",&n); + if(n>=1&&n<=7) + { + f=1; + break; + } + else + { + f=0; + printf("无效操作!"); + } + }while(f==0); + switch(n) + { + case 1:printf(" 录入学生信息\n\n"); type_in(); break; + case 2:printf(" 浏览学生信息\n\n"); system("cls"); scan(); break; + case 3:printf(" 查询学生信息\n\n"); system("cls"); search(); break; + case 4:printf(" 删除学生信息\n\n"); system("cls"); del(); break; + case 5:printf(" 修改学生信息\n\n"); system("cls"); change(); break; + case 6:printf(" 添加学生信息\n\n"); system("sls"); add(); break; + case 7:goto loop; + } + } + loop: + system("cls"); + return 0; + } +/***********************************************************************************/ +void type_in() +{ +int i,m; +printf("请输入需要创建信息的学生人数(1--500):\n"); +scanf("%d",&m); +for (i=0;i=1&&t<=2) +{ +f=1; +break; +} +else +{ +f=0; +printf("您输入有误,请重新选择!"); +} +}while(f==0);system("cls"); +while(f==1) +{ +switch(t) +{ +case 1:printf("按姓名查询\n");search_name();break; +case 2:main();break; +default:break; +} +system("cls"); +} +} +/***********************************************************************************/ +void search_name()/*按姓名查找函数*/ +{ +char name1[10]; +int i,t; +int m=fun(); +printf("请输入要查找的姓名:\n"); +scanf("%s",name1); +for(i=0;i6||c<1) +printf("\n选择错误,请重新选择!\n"); +} +f=0; +} + +} +if(f==1) +printf("\n未找到\n"); +do +{ +switch(c) +{ +case 1:printf("学号改为: "); +scanf("%s",num); +strcpy(student[i-1].num,num); +break; +case 2:printf("姓名改为: "); +scanf("%s",name); +strcpy(student[i-1].name,name); +break; +case 3:printf("年龄改为: "); +scanf("%lld",&age); +student[i-1].age=age; +break; +case 4:printf("电话改为: "); +scanf("%s",tele); +strcpy(student[i-1].tele,tele); +break; +case 5:printf("身份证号改为: "); +scanf("%s",id); +strcpy(student[i-1].id,id); +break; +case 6:printf("性别改为: "); +scanf("%s",sex); +strcpy(student[i-1].sex,sex); +break; +} +printf("\n"); +printf("\n是否确定所修改的信息?\n 是 请按1 ; \n不,重新修改 请按2: \n"); +scanf("%d",&b); +} +while(b==2); +printf("\n浏览修改后的所有学生信息:\n"); +printf("\n"); +baocun(m); +scan(); +printf("\n继续修改请按1,不再修改请按0\n"); +scanf("%d",&t); +switch(t) +{ +case 1:change();break; +case 0:break; +default :break; +}system("cls"); +} +void add() +{ + int n=fun(); + int i,m; + printf("请输入需要创建信息的学生人数(1--500):\n"); + scanf("%d",&m); + for (i=n;i