commit 958e2f22565da63844e6fda9315b6d22cf851ad3 Author: p83456109 <2561354258@qq.com> Date: Fri Jan 11 20:41:15 2019 +0800 first commit diff --git a/课设/ADD.h b/课设/ADD.h new file mode 100644 index 0000000..63fa445 --- /dev/null +++ b/课设/ADD.h @@ -0,0 +1,62 @@ +#include +#include +#include +#include +#define M 100 +void add() +{typedef struct question{ + char mainq[500]; + char ala[150]; + char alb[150]; + char alc[150]; + char ald[150]; + char ans; +}ques; + + char _m[20]="password"; + char _n[20]; + int z=3; + while(z--) + { + printf("㻹%dλԱ룺",z+1);//Ա:password + scanf("%s",_n); + printf("\n"); + if(strcmp(_m,_n)==0)//жǷԱһ + { + system("cls"); + int i,n; + FILE *fp; + ques que[M]; + printf("ӵС100");//޶Ա֤ + scanf("%d",&n); + fp=fopen("question.dat","ab"); + if(fp==NULL) + { + printf("ļʧܣ"); + return ; + } + for(i=1;i<=n;i++) + { + printf("%dɣ",i); + scanf("%s",que[i].mainq); + printf("ѡA"); + scanf("%s",que[i].ala); + printf("ѡB"); + scanf("%s",que[i].alb); + printf("ѡC"); + scanf("%s",que[i].alc); + printf("ѡD"); + scanf("%s",que[i].ald); + getchar(); + printf("ȷѡ:"); + scanf("%c",&que[i].ans); + printf("\n"); + fwrite(&que[i],sizeof(struct question),1,fp);//뵽 + } + fclose(fp); + printf("\t\t\t\t¼,˵"); + break; + } + } + return ; +} diff --git a/课设/ADD.h.gch b/课设/ADD.h.gch new file mode 100644 index 0000000..f7cb729 Binary files /dev/null and b/课设/ADD.h.gch differ diff --git a/课设/BROWSE.h b/课设/BROWSE.h new file mode 100644 index 0000000..649d991 --- /dev/null +++ b/课设/BROWSE.h @@ -0,0 +1,42 @@ +#include +#include +#include +#include +#define M 100 +void browse() +{typedef struct question{ + char mainq[500]; + char ala[150]; + char alb[150]; + char alc[150]; + char ald[150]; + char ans; +}ques; + char _m[20]="password"; + char _n[20]; + int z=3; + while(z--) + { + printf("㻹%dλԱ룺",z+1);//:password + scanf("%s",_n); + printf("\n"); + if(strcmp(_m,_n)==0) + { + ques que[1000]; + FILE *fp=fopen("question.dat","rb"); + int i; + for(i=0;fread(&que[i],sizeof(ques),1,fp)==1;i++)//freadֵΪ1ʱѾļĩβ + { + printf("%d.%s\n",i+1,que[i].mainq); + printf("A.%s\n",que[i].ala); + printf("B.%s\n",que[i].alb); + printf("C.%s\n",que[i].alc); + printf("D.%s\n",que[i].ald); + printf("ȷѡ:%c\n\n",que[i].ans); + } + fclose(fp); + break; + } + } + return ; +} diff --git a/课设/BROWSE.h.gch b/课设/BROWSE.h.gch new file mode 100644 index 0000000..6aeb844 Binary files /dev/null and b/课设/BROWSE.h.gch differ diff --git a/课设/CHANGE.h b/课设/CHANGE.h new file mode 100644 index 0000000..dee22c1 --- /dev/null +++ b/课设/CHANGE.h @@ -0,0 +1,110 @@ +#include +#include +#include +#include +#define M 100 +void change(){ + typedef struct question{ + char mainq[500]; + char ala[150]; + char alb[150]; + char alc[150]; + char ald[150]; + char ans; +}ques; + int z=3; + char _m[]="password"; + char _n[20]; + while(z--) + { + printf("㻹%dλԱ룺",z+1);//룺password + scanf("%s",_n); + printf("\n"); + if(strcmp(_m,_n)==0) + { + FILE *fp,*fp2; + int flag=0,n,jud,i,N; + system("cls"); + char q[500]; + ques que[M],ll; + fp=fopen("question.dat","ab+"); + if(fp==NULL) + { + printf("ļʧ"); + return ; + } + do{ + jud=flag=0; + rewind(fp); + printf("ĵɣ\n"); + scanf("%s",q); + for(i=0;fread(&que[i],sizeof(ques),1,fp)==1;i++) + { + if(strcmp(q,que[i].mainq)==0) + { + printf("Ŀǰ״̬£\n"); + printf("%s\n",que[i].mainq); + printf("A.%s\n",que[i].ala); + printf("B.%s\n",que[i].alb); + printf("C.%s\n",que[i].alc); + printf("D.%s\n",que[i].ald); + printf("ȷѡ%c\n",que[i].ans); + N=i; + flag=1; + break; + } + } + if(flag==1) + { + printf("޸ĵ1.ѡA\t2.ѡB\t3.ѡC\t4.ѡD\t5.\t6.ȷѡ\t0.ȡ޸:\n\t\t\t\t\t\t"); + scanf("%d",&n); + switch(n) + { + case 1:printf("޸ijɵѡA"); + scanf("%s",que[i].ala);break; + case 2:printf("޸ijɵѡB"); + scanf("%s",que[i].alb);break; + case 3:printf("޸ijɵѡC"); + scanf("%s",que[i].alc);break; + case 4:printf("޸ijɵѡD"); + scanf("%s",que[i].ald);break; + case 5:printf("޸ijɵɣ"); + scanf("%s",que[i].mainq);break; + case 6:printf("޸ijɵȷѡ"); + getchar(); + scanf("%c",&que[i].ans);break; + case 0:printf("ȡ޸ijɹ");break; + } + ll=que[i]; + fclose(fp); + fp=fopen("question.dat","rb"); + fp2=fopen("que2.dat","wb"); + for(i=0;fread(&que[i],sizeof(ques),1,fp)==1;i++) + { + if(i!=N) + fwrite(&que[i],sizeof(ques),1,fp2);//Ҫ޸ĵ֮⣬ԭƸһļҪ޸ĵģ޸֮һļ + else + fwrite(&ll,sizeof(ques),1,fp2); + } + fclose(fp); + fclose(fp2); + fp=fopen("question.dat","wb"); + fp2=fopen("que2.dat","rb"); + for(i=0;fread(&que[i],sizeof(ques),1,fp2)==1;i++) + fwrite(&que[i],sizeof(ques),1,fp);//ٸƵԭļ + fclose(fp); + fclose(fp2); + printf("\n"); + printf("\t\t\t\t޸\n"); + } + else + printf("\t\t\t\tδҵ\n"); + printf("绹޸1,ٽ޸0:"); + scanf("%d",&jud); + }while(jud==1); + fclose(fp); + break; + } + } + return ; +} diff --git a/课设/DELE.h b/课设/DELE.h new file mode 100644 index 0000000..0bf8b81 --- /dev/null +++ b/课设/DELE.h @@ -0,0 +1,84 @@ +#include +#include +#include +#include +#define M 100 +void dele(){ + typedef struct question{ + char mainq[500]; + char ala[150]; + char alb[150]; + char alc[150]; + char ald[150]; + char ans; +}ques; + char _m[20]="password"; + char _n[20]; + int z=3; + while(z--) + { + printf("㻹%dλԱ룺",z+1); + scanf("%s",_n); + printf("\n"); + if(strcmp(_m,_n)==0) + { + FILE *fp,*fp2; + int flag=0,n,jud,i; + system("cls"); + char q[500]; + ques que[M]; + fp=fopen("question.dat","ab+"); + if(fp==NULL) + { + printf("ļʧ"); + return ; + } + jud=flag=0; + printf("ɾɣ\n"); + scanf("%s",q); + for(i=0;fread(&que[i],sizeof(ques),1,fp)==1;i++) + { + if(strcmp(q,que[i].mainq)==0) + { + printf("Ŀǰ״̬£\n"); + printf("%s\n",que[i].mainq); + printf("A.%s\n",que[i].ala); + printf("B.%s\n",que[i].alb); + printf("C.%s\n",que[i].alc); + printf("D.%s\n",que[i].ald); + printf("ȷѡ%c\n",que[i].ans); + flag=1; + fclose(fp); + fp2=fopen("que2.dat","wb"); + fp=fopen("question.dat","rb"); + break; + } + } + if(flag) + { + for(i=0;fread(&que[i],sizeof(ques),1,fp)==1;i++){ + if(strcmp(q,que[i].mainq)!=0) + fwrite(&que[i],sizeof(ques),1,fp2);}//ѳҪɾ⸴Ƹһļٰһļƻ + fclose(fp); + fclose(fp2); + fp=fopen("question.dat","wb"); + fp2=fopen("que2.dat","rb"); + for(i=0;fread(&que[i],sizeof(ques),1,fp2)==1;) + { + fwrite(&que[i],sizeof(ques),1,fp); + i++; + } + fclose(fp); + fclose(fp2); + printf("\t\t\t\tɹɾ"); + } + else + { + fclose(fp); + printf("\t\t\t\tδҵ"); + } + break; + } + } + return ; +} diff --git a/课设/DELE.h.gch b/课设/DELE.h.gch new file mode 100644 index 0000000..84852d6 Binary files /dev/null and b/课设/DELE.h.gch differ diff --git a/课设/TEST.h b/课设/TEST.h new file mode 100644 index 0000000..c2d91fb --- /dev/null +++ b/课设/TEST.h @@ -0,0 +1,92 @@ +#include +#include +#include +#include +#define M 100 +void test() +{typedef struct question{ + char mainq[500]; + char ala[150]; + char alb[150]; + char alc[150]; + char ald[150]; + char ans; +}ques; + srand(unsigned(time(0)));//ʱ + FILE *fp; + ques que[1000]; + int f[10000]; + memset(f,0,sizeof(int)*10); + int a[1000],flak; + char b[1000]={0},c[1000]; + int i,n,N,count1=0,count=0,sel,j,temp; + fp=fopen("question.dat","rb"); + if(fp==NULL) + { + printf("ļ\n"); + return ; + } + for(i=0;fread(&que[i],sizeof(ques),1,fp)==1;i++); + N=i; + printf("ѡ(Էȷ/*100С%d):",N); + scanf("%d",&n); + while(counta[j+1]) + { + temp=a[j]; + a[j]=a[j+1]; + a[j+1]=temp; + } + } + } + count=0; + for(i=0;count +#include +#include +#include +#include"CHANGE.h" +#include"DELE.h" +#include"BROWSE.h" +#include"TEST.h" +#include"ADD.h" +#define M 100 +typedef struct question{ + char mainq[500]; + char ala[150]; + char alb[150]; + char alc[150]; + char ald[150]; + char ans; +}ques; +int main() +{ + int n; + do{ + system("cls"); + printf("\t\t\t\t\t\t************************\t\t\t\n"); + printf("\t\t\t\t\t\tѡ׼ϵͳ\t\t\t\n"); + printf("\t\t\t\t\t\t1.ʼ\t\t\t\n"); + printf("\t\t\t\t\t\t2.\t\t\t\n"); + printf("\t\t\t\t\t\t3.ɾ\t\t\t\n"); + printf("\t\t\t\t\t\t4.޸\t\t\t\n"); + printf("\t\t\t\t\t\t5.鿴\t\t\t\n"); + printf("\t\t\t\t\t\t0.˳ϵͳ\t\t\t\n"); + printf("ҪʹõĹܣ0~5"); + scanf("%d",&n); + switch(n) + { + case 1:test();system("pause");break; + case 2:add();system("pause");break; + case 3:dele();system("pause");break; + case 4:change();system("pause");break; + case 5:browse();system("pause");break; + case 0:printf("\t\t\t\t\tлʹã ټ");break; + default:printf("ȷѡ0~5");system("pause"); + break; + }printf("\n"); + }while(n!=0); + return 0; +} diff --git a/课设/单项选择题标准化系统.exe b/课设/单项选择题标准化系统.exe new file mode 100644 index 0000000..e73bb89 Binary files /dev/null and b/课设/单项选择题标准化系统.exe differ