commit dfa8ba8b3044856d198850e98f8e4e4fd6f91af6 Author: unknown <18408000735@stu.hut.edu.cn> Date: Sat Jan 12 17:29:57 2019 +0800 first commit diff --git a/未命名1.cpp b/未命名1.cpp new file mode 100644 index 0000000..93c6e93 --- /dev/null +++ b/未命名1.cpp @@ -0,0 +1,792 @@ +#include +#include +#include +#define NMAX 4 //ѧԺÿĿ4 +#define MAX 3 // +#define PEOPLE_MAX 6 //÷6Ϊֽ +struct baoming +{ + char number[12]; + char school[15]; + char name[12]; + char sex[10]; + char sport1[10]; + char sport2[10]; + char sport3[10]; +}; +void sign(struct baoming com,FILE *fp1,char d[]) +{ + printf("\tѧ:\n"); + scanf("%s",com.number); + printf("\n"); + scanf("%s",com.name); + char a[]={""}; + char b[]={"Ů"}; + printf("\tԱ\n"); + printf("\t1. 2.Ů"); + int sex1; + scanf("%d",&sex1); + if(sex1==1) + { + strcpy(com.sex,a); + printf("ĿУ"); + printf("1.ǹ 2. 3.100 4.400 5.1000 6.5000 7.Զ"); + printf("\nҪĿû"); + scanf("%s",com.sport1); + printf("ٴ"); + scanf("%s",com.sport2); + printf("ٴ"); + scanf("%s",com.sport3); + fprintf(fp1,"%s %s %s %s %s %s %s\n ",com.number,d,com.name,com.sex,com.sport1,com.sport2,com.sport3); + } + else + { + strcpy(com.sex,b); + printf("ŮĿУ"); + printf("1.ǹ 2. 3.100 4.400 5.1000 6.5000 7.Զ"); + printf("\nҪĿû"); + scanf("%s",com.sport1); + printf("ٴ"); + scanf("%s",com.sport2); + printf("ٴ"); + scanf("%s",com.sport3); + fprintf(fp1,"%s %s %s %s %s %s %s\n",com.number,d,com.name,com.sex,com.sport1,com.sport2,com.sport3); + } + fclose(fp1); + printf("ټ"); +} +void sign_up() +{ + printf("ѡѧԺ:"); + printf("1.ѧԺ 2.ѧԺ"); + printf("3.ѧԺ 4.еѧԺ"); + printf("5.ľѧԺ 6.óѧԺ"); + int choice; + scanf("%d",&choice); + switch(choice) + { + case 1: + { + FILE *fp; + char a[]="ѧԺ"; + struct baoming stu; + fp=fopen("computer.txt","a+"); + if(fp==NULL) + printf("ļʧܣ"); + sign(stu,fp,a); + break; + } + case 2: + { + FILE *fp; + char b[]="ѧԺ"; + struct baoming stu; + fp=fopen("dianqi.txt","a+"); + if(fp==NULL) + printf("ļʧܣ"); + sign(stu,fp,b); + break; + } + case 3: + { + FILE *fp; + char c[]="ѧԺ"; + struct baoming stu; + fp=fopen("wenxin.txt","a+"); + if(fp==NULL) + printf("ļʧܣ"); + sign(stu,fp,c); + break; + } + case 4: + { + FILE *fp; + char d[]="еѧԺ"; + struct baoming stu; + fp=fopen("jixie.txt","a+"); + if(fp==NULL) + printf("ļʧܣ"); + sign(stu,fp,d); + break; + } + case 5: + { + FILE *fp; + char e[]="ľѧԺ"; + struct baoming stu; + fp=fopen("tumu.txt","a+"); + if(fp==NULL) + printf("ļʧܣ"); + sign(stu,fp,e); + break; + } + case 6: + { + FILE *fp; + char f[]="óѧԺ"; + struct baoming stu; + fp=fopen("jingmao.txt","a+"); + if(fp==NULL) + printf("ļʧܣ"); + sign(stu,fp,f); + break; + } + } +} +void chaxun(struct baoming stu,FILE *fp1) +{ + char numbers[12]; + int flag=0; + printf("\tҪѯѧ"); + scanf("%s",numbers); + while(!feof(fp1)&&flag==0) + { + fscanf(fp1,"%s%s%s%s%s%s%s%s",&stu.number,stu.school,stu.name,stu.sex,stu.sport1,stu.sport2,stu.sport3); + if(strncmp(numbers,stu.number,11)==0) + { + printf("%s %s %s %s %s %s %s",stu.number,stu.name,stu.sex,stu.sport1,stu.sport2,stu.sport3); + flag=1; + printf("\tѯɹ"); + } + + } + fclose(fp1); +} +void bmchaxun() +{ + int x; + printf("ѡѧԺ"); +printf("1.ѧԺ 2.ѧԺ"); + printf("3.ѧԺ 4.ѧԺ"); + printf("5.ľѧԺ 6.óѧԺ"); + scanf("%d",&x); + switch(x) + { + case 1: + { + struct baoming com; + FILE *fp=fopen("computer.txt","r"); + if(fp==NULL) + { + printf("ļʧܣ"); + } + chaxun(com,fp); + break; + } + case 2: + { + struct baoming com; + FILE *fp=fopen("dianqi.txt","r"); + if(fp==NULL) + { + printf("ļʧܣ"); + } + chaxun(com,fp); + break; + } + case 3: + { + struct baoming com; + FILE *fp=fopen("wenxin.txt","r"); + if(fp==NULL) + { + printf("ļʧܣ"); + } + chaxun(com,fp); + break; + } + case 4: + { + struct baoming com; + FILE *fp=fopen("jixie.txt","r"); + if(fp==NULL) + { + printf("ļʧܣ"); + } + chaxun(com,fp); + break; + } + case 5: + { + struct baoming com; + FILE *fp=fopen("tumu.txt","r"); + if(fp==NULL) + { + printf("ļʧܣ"); + } + chaxun(com,fp); + break; + } + case 6: + { + struct baoming com; + FILE *fp=fopen("jingmao.txt","r"); + if(fp==NULL) + { + printf("ļʧܣ"); + } + chaxun(com,fp); + break; + } + } +} +struct jianlu + { + char number[12]; + char school[15]; + char name[10]; + char sex[5]; + char sport[10]; + }; +void xie_ru(struct baoming stu,FILE *fp,FILE *fp1,char a[]) +{ + long last,h; + fseek(fp1,0L,SEEK_END); + last=ftell(fp1); + rewind(fp1); + while((h=ftell(fp1))PEOPLE_MAX) + { + while(h=ftell(fp):"); + scanf("%d",&choice1); + switch(choice1) + { + case 1: + system("cls"); + sign_up(); + break; + case 2: + system("cls"); + bmchaxun(); + break; + case 3: + system("cls"); + jianlu(); + break; + case 4: + system("cls"); + dengji(); + break; + case 5: + system("cls"); + cjcx(); + break; + case 6: + system("cls"); + paixu(); + break; + } + }while(0); +} +int main(void) +{ + system("color 3f"); + menu(); +} + diff --git a/未命名1.exe b/未命名1.exe new file mode 100644 index 0000000..6faa749 Binary files /dev/null and b/未命名1.exe differ