您的当前位置:首页用C语言开发小型数据库管理系统代码

用C语言开发小型数据库管理系统代码

2024-07-16 来源:乌哈旅游



Forpersonal use only in study and research; not for commercial use

#include<stdio.h>

#include<string.h>

typedef

/*±£´æ¼Ç¼ÌõÊý½á¹¹Ìå*/

struct

count{

char name[10];

int num;

}count;

typedefstruct st{

charname[10];

longNumber;

intMath;

intC;

intAmount;

}st;

strecord[8];

countnum[1];

charfilename[10]={"0"};

charfilename2[10]={"0"};

intInputnum[8];



voidMainMenu(){ /*Ö÷²Ëµ¥*/

printf("\n\t\t\t\t** * * * * * * * *\n");

printf("\t\t\t\t* Ö÷²Ëµ¥ *\n");

printf("\t\t\t\t*1. ´´½¨ÐÂÎļþ *\n");

printf("\t\t\t\t*2. Ìí¼Ó¼Ç¼ *\n");

printf("\t\t\t\t*3. ɾ³ý¼Ç¼ *\n");

printf("\t\t\t\t*4. ÅÅÐò *\n");

printf("\t\t\t\t*5. ²éѯ¼Ç¼ *\n");

printf("\t\t\t\t*6. Í˳ö *\n");

printf("\t\t\t\t** * * * * * * * *\n");

}

voidDelMenu(){ /*ɾ³ý²Ëµ¥*/

printf("\n\t\t\t\t** * * * * * * * * * *\n");

printf("\t\t\t\t* ɾ³ý²Ëµ¥ *\n");

printf("\t\t\t\t*1. ѧºÅ²éѯɾ³ý *\n");

printf("\t\t\t\t*2. ·µ»Øµ½Éϼ¶²Ëµ¥ *\n");

printf("\t\t\t\t** * * * * * * * * * *\n");

}

voidRankingMenu(){ /*ÅÅÐò²Ëµ¥*/

printf("\n\t\t\t\t** * * * * * * * * * *\n");



printf("\t\t\t\t* ÅÅÐò²Ëµ¥ *\n");

printf("\t\t\t\t*1. Êýѧ³É¼¨ÅÅÐò *\n");

printf("\t\t\t\t*2. CÓïÑԳɼ¨ÅÅÐò *\n");

printf("\t\t\t\t*3. ×Ü·ÖÅÅÐò *\n");

printf("\t\t\t\t*4. ·µ»Øµ½Éϼ¶²Ëµ¥ *\n");

printf("\t\t\t\t** * * * * * * * * * *\n");

}

voidInquireMenu(){ /*²éѶ²Ëµ¥*/

printf("\n\t\t\t\t** * * * * * * * * * *\n");

printf("\t\t\t\t* ²éѶ²Ëµ¥ *\n");

printf("\t\t\t\t*1. ѧºÅ²éѶ *\n");

printf("\t\t\t\t*2. ÐÕÃû²éѶ *\n");

printf("\t\t\t\t*3. Êýѧ³É¼¨²éѶ *\n");

printf("\t\t\t\t*4. CÓïÑԳɼ¨²éѶ *\n");

printf("\t\t\t\t*5. ×Ü·Ö²éѶ *\n");

printf("\t\t\t\t*6. ·µ»Øµ½Éϼ¶²Ëµ¥ *\n");

printf("\t\t\t\t** * * * * * * * * * *\n");

}

char

Inputfilename(){ /*ÊäÈëÎļþÃûͬʱ²ú

Éú¸¶±¾ÎļþÃû*/



charstr2[]={"B"};

printf("**ÇëÊäÈëÎļþÃû ** : ");

scanf("%s",filename);

getchar();

strcpy(filename2,filename);

strcat(filename2,str2);

}

/*¶ÁÈ¡Îĵµ*/

FILE

*readfile(){

FILE *fp1;

if((fp1=fopen(filename,"rb"))==NULL)

{printf("\nÎļþ¶ÁÈ¡´íÎó!!\n");

fclose(fp1);

}

return(fp1);

}

FILE *foundfile(){

FILE *fp1;

/*н¨Îĵµ*/

if((fp1=fopen(filename,"wb"))==NULL)

{printf("\nÎļþ´´½¨´íÎó!!\n");

fclose(fp1);



}

return(fp1);

}

/*×·¼ÓÎĵµ*/

FILE

*savefile(){

FILE *fp1;

if((fp1=fopen(filename,"ab"))==NULL)

{printf("\nÎļþ×·¼Ó´íÎó!!\n");

罿

fclose(fp1);

}

return(fp1);

}

intInputSave(){ /*Ìí¼ÓÊý¾Ý

*/

inti=0,j;

charch='y';

while(ch!='w')

{i=i+1;

printf("\n**ÇëÊäÈëÐÕÃû(×Ö·ûÐÍ) ** :");

scanf("%s",record[i].name);

Loop1:printf("\n** ÇëÊäÈëѧºÅ(³¤ÕûÐÍ) ** :");



scanf("%ld",&record[i].Number);

if(i!=1)

for(j=1;j<i;j++)

if(record[i].Number==record[j].Number)

{printf("\n\t¾¯¸æ!ÊäÈëÁ˶þ¸öͬÑùµÄѧºÅ!

µÚ%dÌõºÍµÚ%dѧºÅÏàͬ!\n",i,j);

printf("\n\tÇëÖØÐÂÊäÈë!\n");

gotoLoop1;

}

Loop2:printf("\n** ÇëÊäÈëÊýѧ³É¼¨(ÕûÐÍ) ** :");

scanf("%d",&record[i].Math);

if(record[i].Math>100||record[i].Math<0)

{printf("\n\tÊäÈëµÄ·ÖÊý²»·þºÏʵ¼ÊÒªÇó!ÇëÖØмÈë!\n");

gotoLoop2;

}

Loop3:printf("\n** ÇëÊäÈëCÓïÑԳɼ¨(ÕûÐÍ) ** :");

scanf("%d",&record[i].C);

if(record[i].C>100||record[i].C<0)

{printf("\n\tÊäÈëµÄ·ÖÊý²»·þºÏʵ¼ÊÒªÇó!ÇëÖØмÈë!\n");

gotoLoop3;

}

record[i].Amount=record[i].Math+record[i].C;



printf("\n'w'=½áÊø¼Èë 's'=ÖØмÈë´ËÌõ¼Ç¼'n'=ÏÂÒ»Ìõ : ");

getchar();

/*³ÔµôÉÏÒ»¸ö»Ø³µ·û*/

if((ch=getchar())=='s')

i=i-1;

}

return(i);

}

/*

void ReadComputer(int i,FILE

*fp1){ (Îı¾·½Ê½)Êý¾ÝдÈë»úÆ÷

intj;

for(j=1;j<i+1;j++)

fscanf(fp1,"%s,%ld,%d,%d,%d",record[j].name,&record[j].Number,&rec

ord[j].Math,&record[j].C,&record[j].Amount);

}

void

SaveFile(int

i,FILE

*fp1){ (Îı¾·½Ê½)Êý¾Ýдµ½Îļ

þÖÐ

intj;

for(j=1;j<i+1;j++)

fprintf(fp1,"%s,%ld,%d,%d,%d",record[j].name,record[j].Number,reco



rd[j].Math,record[j].C,record[j].Amount);

}

*/

void ReadComputer2(int i,FILE

*fp1){ /*(2·½Ê½)Êý¾ÝдÈë»úÆ÷*/

intj;

for(j=1;j<i+1;j++)

if((fread(&record[j],sizeof(structst),1,fp1))!=1)

{printf("\nÖ÷ÎļþÊý¾Ý¶ÁÈ¡´íÎó!\n");

fclose(fp1);

}

}

void

SaveFile2(int

i,FILE

*fp1){ /*(2·½Ê½)Êý¾Ýдµ½ÎļþÖ

Ð*/

intj;

for(j=1;j<i+1;j++)

if((fwrite(&record[j],sizeof(structst),1,fp1))!=1)

{printf("\nÖ÷ÎļþÊý¾ÝдÈë´íÎó!\n");

fclose(fp1);

}

}



/*

************************************************************

************************************************************/

FILE

*readfile2(){ /*¶ÁÎļþ¸¶±¾

*/

FILE*fp1;

if((fp1=fopen(filename2,"rb"))==NULL)

{printf("\n¸¶±¾Îļþ¶ÁÈ¡´íÎó!\n");

fclose(fp1);

}

return(fp1);

}

FILE

*foundfile2(){ /*н¨Îļþ¸

¶±¾*/

FILE*fp1;

if((fp1=fopen(filename2,"wb"))==NULL)

{printf("\n¸¶±¾Îļþ´´½¨´íÎó!\n");

fclose(fp1);

}

return(fp1);

}



FILE

*savefile2(){ /*×·¼ÓÎļþ¸

¶±¾*/

FILE*fp1;

if((fp1=fopen(filename2,"ab"))==NULL)

{printf("\n¸¶±¾Îļþ×·¼Ó´íÎó!\n");

fclose(fp1);

}

return(fp1);

}

/*

void Additive2(int i,FILE

*fp1){ Êý¾ÝÓëÈ븶±¾Îļþ£¨Îı¾·½Ê½£©

intj;

charstr2={"0"};

if(strcmp(filenameF,str2)!=0)

strcpy(num[0].name,filenameF);

else

strcpy(num[0].name,filenameA);

num[0].num=i;

fprintf(fp1,"%s,%d",num[0].name,num[0].num);

}



int

ReadComputer2(FILE

*fp1){ ¶Á³ö¸¶±¾ÖеÄÊý¾Ý£¨Îı¾·½Ê½

£©

intj,k;

fscanf(fp1,"%s,%d",num[0].name,&num[0].num);

k=num[0].num;

return(k);

}

*/

void

Additive2Two(int

i,FILE

*fp1){ /*Êý¾ÝдÈ븶±¾Îļþ£¨¶þ½øÖÆ·½Ê½

£©*/

charstr2[]={"0"};

if(strcmp(filename2,str2)!=0)

strcpy(num[0].name,filename2);

else

罿 strcpy(num[0].name,filename2);

num[0].num=i;

if((fwrite(&num[0],sizeof(structcount),1,fp1))!=1)

{printf("\n¸¶±¾ÎļþÊý¾ÝдÈë´íÎó!\n");

fclose(fp1);



}

}

int

ReadComputer2Two(FILE

*fp1){ /*¶Á³ö¸¶±¾ÖеÄÊý¾Ý£¨¶þ½øÖÆ

·½Ê½£©*/

intj;

if((fread(&num[0],sizeof(structcount),1,fp1))!=1)

{printf("\n¸¶±¾ÎļþÊý¾Ý¶ÁÈ¡´íÎó!\n");

fclose(fp1);

}

j=num[0].num;

return(j);

}

/*

************************************************************

************************************************************/

void

Num_inquire(){ /*ѧºÅ²éÑ

¯*/

int num,j,time;

fp1=readfile();

FILE *fp1,*fp2;

/*¶ÁÈ¡Îĵµ*/

fp2=readfile2();

/*(¿ª´ò·½Ê½'¶Á'**'ÒýÓöÁÎļþÃû')¶ÁÎļþ¸¶±¾*/



time=ReadComputer2Two(fp2);

/*¶Á³ö¸¶±¾ÖеÄÊý¾Ý£¨¶þ½øÖÆ·½Ê½£©*/

ReadComputer2(time,fp1);

/*(2·½Ê½)Êý¾ÝдÈë»úÆ÷*/

fclose(fp1);fclose(fp2);

printf("ÊäÈëѧºÅ:");

scanf("%ld",&num);

/*getchar();*/

for(j=1;j<time+1;j++)

{if(record[j].Number==num)

printf("\nName:%-10s Num:%3ld Math:%3d C:%3d

Amount:%3d\n",record[j].name,record[j].Number,record[j].Math,recor

d[j].C,record[j].Amount);

}

}

void

Name_inquire(){ /*ÐÕÃû²éÑ

¯*/

int j,time;

fp2=readfile2();

char Name[10];

FILE *fp1,*fp2;

fp1=readfile();

/*(¿ª´ò·½Ê½'¶Á'**'ÒýÓöÁÎļþÃû')¶ÁÎļþ¸¶±¾*/

time=ReadComputer2Two(fp2);



/*¶Á³ö¸¶±¾ÖеÄÊý¾Ý£¨¶þ½øÖÆ·½Ê½£©*/

ReadComputer2(time,fp1);

/*(2·½Ê½)Êý¾ÝдÈë»úÆ÷*/

fclose(fp1);fclose(fp2);

printf("ÊäÈëÐÕÃû:");

scanf("%s",Name);

/*getchar();*/

for(j=1;j<time+1;j++)

{if(strcmp(Name,record[j].name)==0)

printf("\nName:%-10s Num:%3ld Math:%3d C:%3d

Amount:%3d\n",record[j].name,record[j].Number,record[j].Math,recor

d[j].C,record[j].Amount);

}

}

void

Math_inquire(){ /*Êýѧ²éÑ

¯*/

int Math,j,time;

fp2=readfile2();

FILE *fp1,*fp2;

fp1=readfile();

/*(¿ª´ò·½Ê½'¶Á'**'ÒýÓöÁÎļþÃû')¶ÁÎļþ¸¶±¾*/

time=ReadComputer2Two(fp2);

/*¶Á³ö¸¶±¾ÖеÄÊý¾Ý£¨¶þ½øÖÆ·½Ê½£©*/

ReadComputer2(time,fp1);



/*(2·½Ê½)Êý¾ÝдÈë»úÆ÷*/

fclose(fp1);fclose(fp2);

printf("ÊäÈëÊýѧ³É¼¨:");

scanf("%d",&Math);

/*getchar();*/

for(j=1;j<time+1;j++)

{if(record[j].Math>=Math)

printf("\nName:%-10s Num:%3ld Math:%3d C:%3d

Amount:%3d\n",record[j].name,record[j].Number,record[j].Math,recor

d[j].C,record[j].Amount);

}

}

void

C_inquire(){ /*C²éѯ*

/

int C,j,time;

fp2=readfile2();

FILE *fp1,*fp2;

fp1=readfile();

/*(¿ª´ò·½Ê½'¶Á'**'ÒýÓöÁÎļþÃû')¶ÁÎļþ¸¶±¾*/

time=ReadComputer2Two(fp2);

/*¶Á³ö¸¶±¾ÖеÄÊý¾Ý£¨¶þ½øÖÆ·½Ê½£©*/

ReadComputer2(time,fp1);

/*(2·½Ê½)Êý¾ÝдÈë»úÆ÷*/



fclose(fp1);fclose(fp2);

printf("ÊäÈëCÓïÑԳɼ¨:");

scanf("%d",&C);

/*getchar();*/

for(j=1;j<time+1;j++)

{if(record[j].C>=C)

printf("\nName:%-10s Num:%3ld Math:%3d C:%3d

Amount:%3d\n",record[j].name,record[j].Number,record[j].Math,recor

d[j].C,record[j].Amount);

}

}

void

Amount_inquire(){ /*×Ü·Ö²é

ѯ*/

int Amount,j,time;

fp2=readfile2();

FILE *fp1,*fp2;

fp1=readfile();

/*(¿ª´ò·½Ê½'¶Á'**'ÒýÓöÁÎļþÃû')¶ÁÎļþ¸¶±¾*/

time=ReadComputer2Two(fp2);

/*¶Á³ö¸¶±¾ÖеÄÊý¾Ý£¨¶þ½øÖÆ·½Ê½£©*/

ReadComputer2(time,fp1);



/*(2·½Ê½)Êý¾ÝдÈë»úÆ÷*/

fclose(fp1);fclose(fp2);

printf("ÊäÈë×Ü·Ö:");

scanf("%d",&Amount);

/*getchar();*/

for(j=1;j<time+1;j++)

{if(record[j].Amount>=Amount)

printf("\nName:%-10s Num:%3ld Math:%3d C:%3d

Amount:%3d\n",record[j].name,record[j].Number,record[j].Math,recor

d[j].C,record[j].Amount);

}

}

/*

************************************************************

************************************************************/

void

Num_inquire_Del(){ /*ѧºÅ²éÑ

¯É¾³ý*/

char ch;

fp1=readfile();

int num,j,k,time;

FILE *fp1,*fp2;

/*¶ÁÈ¡Îĵµ*/

fp2=readfile2();

/*¶ÁÎļþ¸¶±¾*/

time=ReadComputer2Two(fp2);

/*¶Á³ö¸¶±¾ÖеÄÊý¾Ý£¨¶þ½øÖÆ·½Ê½£©*/



ReadComputer2(time,fp1);/*(2·½Ê½)Êý¾ÝдÈë»úÆ÷*/

fclose(fp1);fclose(fp2);

Num:%3ld

Math:%3d

C:%3d

printf("ÊäÈëѧºÅ:");

scanf("%ld",&num);

getchar();

for(j=1;j<=time;j++)

if(record[j].Number==num)

{printf("\nName:%-10s

Amount:%3d\n",record[j].name,record[j].Number,record[j].Math,record[j].C,record[j].Amount);

k=j;

²»É¾³ý='n' ** : ");

fp1=foundfile();

}

printf("\n\t**

ɾ³ý='y'

if((ch=getchar())=='y')

{

if(k==time)

time=time-1;

else for(j=k;j<time;j++)

{record[j]=record[j+1];

time=time-1;

}

/*н¨Îĵµ*/



SaveFile2(time,fp1);

/*(2·½Ê½)Êý¾Ýдµ½ÎļþÖÐ*/

fp2=foundfile2();

/*н¨Îļþ¸¶±¾*/

Additive2Two(time,fp2);

/*Êý¾ÝÓëÈ븶±¾Îļþ£¨¶þ½øÖÆ·½Ê½£©*/

printf("\nɾ³ý³É¹¦!¡¡Ä¿Ç°¹²ÓÐ%dÌõ¼Ç¼!\n",time);

fclose(fp1);fclose(fp2);

}

elseprintf("\nûÓÐÖ´ÐÐɾ³ý²Ù×÷!\n");

}

/*************************************************************

************************************************************/

void Math_ranking(int

i){ /*ÊýѧÅÅÐòº¯Êý*/

intj,k;

sttime;

for(j=1;j<i;j++)

for(k=1;k<=i-j;k++)

if(record[k].Math>record[k+1].Math)

{time=record[k];record[k]=record[k+1];record[k+1]=time;}

printf("\n");

for(j=1;j<i+1;j++)

printf("\nName:%-10s Num:%3ld Math:%3d C:%3d

Amount:%3d\n",record[j].name,record[j].Number,record[j].Math,recor



d[j].C,record[j].Amount);

}

void C_ranking(int

i){ /*CÅÅÐòº¯Êý*/

intj,k;

sttime;

for(j=1;j<i;j++)

for(k=1;k<=i-j;k++)

if(record[k].C>record[k+1].C)

{time=record[k];record[k]=record[k+1];record[k+1]=time;}

printf("\n");

for(j=1;j<i+1;j++)

printf("\nName:%-10s Num:%3ld Math:%3d C:%3d

Amount:%3d\n",record[j].name,record[j].Number,record[j].Math,recor

d[j].C,record[j].Amount);

}

void Amount_ranking(int

i){ /*×Ü·ÖÅÅÐòº¯Êý*/

罿 intj,k;

sttime;

for(j=1;j<i;j++)

for(k=1;k<=i-j;k++)



if(record[k].Amount>record[k+1].Amount)

{time=record[k];record[k]=record[k+1];record[k+1]=time;}

printf("\n");

for(j=1;j<i+1;j++)

printf("\nName:%-10s Num:%3ld Math:%3d C:%3d

Amount:%3d\n",record[j].name,record[j].Number,record[j].Math,recor

d[j].C,record[j].Amount);

}

/*

************************************************************

************************************************************/

main(){

FILE*fp,*ffp;

inttemp1=0,temp2=0,temp3;

charch,location;

MainMenu();

location='1';

printf("\nÇëÊäÈëÑ¡Ïî1 - 6 (µ±Ç°ÔÚÖ÷²Ëµ¥):");

while((ch=getchar())!='0')

{if((ch=='6')&&(location=='1'))

{getchar();

printf("\n\n\t\t\t**'Y'=Ðø¼Ì 'n'=Í˳ö **\n");

printf("\n\n\t\tINPUT:");

if((ch=getchar())=='n')



{printf("\n\n\t\t\t ллÄúµÄʹÓÃ!");

exit();

break;

}

else{MainMenu();location='1';

printf("\nÇëÊäÈëÑ¡Ïî1 - 6 (µ±Ç°ÔÚÖ÷²Ëµ¥):");

}

}

if((ch=='1')&&(location=='1'))

{

temp1=InputSave();

/*Ìí¼ÓÊý¾Ý*/

getchar();

printf("\t\t**'y'=±£´æ 'n'=²»±£´æ ** : ");

if((ch=getchar())=='y')

{Inputfilename();

/*ÊäÈëÎļþÃûͬʱ²úÉú¸¶±¾ÎļþÃû*/

fp=foundfile();

/*н¨Îĵµ*/

SaveFile2(temp1,fp);

/*(2·½Ê½)Êý¾Ýдµ½ÎļþÖÐ*/

fclose(fp);

ffp=foundfile2();

/*(¿ª´ò·½Ê½'н¨')н¨Îļþ¸¶±¾*/



Additive2Two(temp1,ffp);

/*н¨¸¶±¾ÎļþÊý¾Ý£¨Îı¾·½Ê½£©*/

fclose(ffp);

printf("±£´æÁË%dÌõ¼Ç¼!\n",temp1);

}

elseprintf("\t ûÓб£´æ!\n");

temp1=0;temp2=0;

MainMenu();location='1';

printf("\nÇëÊäÈëÑ¡Ïî1 - 6 (µ±Ç°ÔÚÖ÷²Ëµ¥):");

continue;

}

if((ch=='2')&&(location=='1'))

{getchar();

printf("\n\t ** 'y'=ʹÓõ±Ç°ÎļþÃû 'n'=ÊäÈëÐÂÎļþÃû

**: ");

if((ch=getchar())=='y')

fp=savefile();

/*×·¼ÓÎĵµ*/

else

{Inputfilename();

/*ÊäÈëÎļþÃûͬʱ²úÉú¸¶±¾ÎļþÃû*/

}

fp=savefile();

temp1=InputSave();

/*Ìí¼ÓÊý¾Ý*/



temp3=temp1;

SaveFile2(temp1,fp);

/*(2·½Ê½)Êý¾Ýдµ½ÎļþÖÐ*/

fclose(fp);

ffp=readfile2();

/*¶ÁÎļþ¸¶±¾*/

temp2=ReadComputer2Two(ffp);

/*¶Á³ö¸¶±¾ÖеÄÊý¾Ý£¨Îı¾·½Ê½£©*/

fclose(ffp);

ffp=foundfile2();

temp1=temp1+temp2;

/*н¨Îļþ¸¶±¾*/

Additive2Two(temp1,ffp);

/*н¨¸¶±¾ÎļþÊý¾Ý£¨Îı¾·½Ê½£©*/

fclose(ffp);

printf("\nÌí¼ÓÀ-%dÌõÊý¾Ý!¹²±£´æ%dÌõÊý¾Ý!\n",temp3,temp1);

temp1=0;temp2=0;

MainMenu();location='1';

printf("\nÇëÊäÈëÑ¡Ïî1 - 6 (µ±Ç°ÔÚÖ÷²Ëµ¥):");

continue;

}

if((ch=='3')&&(location=='1'))

罿{DelMenu();location='2';



printf("\nÇëÊäÈëÑ¡Ïî1 - 3 (µ±Ç°ÔÚɾ³ý²Ëµ¥):");

while((ch=getchar())!='0'){

if((ch=='1')&&(location=='2'))

{getchar();

printf("\n\t\t **ÏÖÔÚλÖÃÔÚɾ³ý²Ëµ¥ -

ѧºÅɾ³ý**\n");

printf("\n\t ** 'y'=ʹÓõ±Ç°ÎļþÃû

'n'=ÊäÈëÐÂÎļþÃû** : ");

if((ch=getchar())=='y')

{}

/*×·¼ÓÎĵµ*/

else

Inputfilename();

/*ÊäÈëÎļþÃûͬʱ²úÉú¸¶±¾ÎļþÃû*/

Num_inquire_Del();

/*ѧºÅ²éѯɾ³ý*/

DelMenu();location='2';

printf("\nÇëÊäÈëÑ¡Ïî1 - 3 (µ±Ç°ÔÚɾ³ý²Ëµ¥):");

continue;

}

if((ch=='2')&&(location=='2'))

{MainMenu();location='1';

printf("\nÇëÊäÈëÑ¡Ïî1 - 6 (µ±Ç°ÔÚÖ÷²Ëµ¥):");

break;

}

}



}

if((ch=='4')&&(location=='1'))

{RankingMenu();location='3';

printf("\nÇëÊäÈëÑ¡Ïî1 - 4 (µ±Ç°ÔÚÅÅÐò²Ëµ¥):");

while((ch=getchar())!='0'){

if((ch=='1')&&(location=='3'))

{getchar();

printf("\n\t\t **ÏÖÔÚλÖÃÔÚÅÅÐò²Ëµ¥ -

ÊýѧÅÅÐò**\n");

printf("\n\t ** 'y'=ʹÓõ±Ç°ÎļþÃû

'n'=ÊäÈëÐÂÎļþÃû** : ");

if((ch=getchar())=='y')

{}

/*×·¼ÓÎĵµ*/

else Inputfilename();

fp=readfile();

/*¶ÁÈ¡Îĵµ*/

ffp=readfile2();

/*(¿ª´ò·½Ê½'¶Á'**'ÒýÓöÁÎļþÃû')¶ÁÎļþ¸¶±¾*/

temp1=ReadComputer2Two(ffp);

/*¶Á³ö¸¶±¾ÖеÄÊý¾Ý£¨¶þ½øÖÆ·½Ê½£©*/

fclose(ffp);

ReadComputer2(temp1,fp);

/*(2·½Ê½)Êý¾ÝдÈë»úÆ÷*/



fclose(fp);

Math_ranking(temp1);

/*ÊýѧÅÅÐòº¯Êý*/

temp1=0;temp2=0;

RankingMenu();location='3';

printf("\nÇëÊäÈëÑ¡Ïî1 - 4 (µ±Ç°ÔÚÅÅÐò²Ëµ¥):");

continue;

}

if((ch=='2')&&(location=='3'))

{getchar();

printf("\n\t\t **ÏÖÔÚλÖÃÔÚÅÅÐò²Ëµ¥ -

CÓïÑÔÅÅÐò**\n");

printf("\n\t ** 'y'=ʹÓõ±Ç°ÎļþÃû

'n'=ÊäÈëÐÂÎļþÃû** : ");

if((ch=getchar())=='y')

{}

/*×·¼ÓÎĵµ*/

else Inputfilename();

fp=readfile();

/*¶ÁÈ¡Îĵµ*/

ffp=readfile2();

/*(¿ª´ò·½Ê½'¶Á'**'ÒýÓöÁÎļþÃû')¶ÁÎļþ¸¶±¾*/

temp1=ReadComputer2Two(ffp);

/*¶Á³ö¸¶±¾ÖеÄÊý¾Ý£¨¶þ½øÖÆ·½Ê½£©*/

fclose(ffp);

ReadComputer2(temp1,fp);



/*(2·½Ê½)Êý¾ÝдÈë»úÆ÷*/

fclose(fp);

C_ranking(temp1);

/*ÊýѧÅÅÐòº¯Êý*/

temp1=0;temp2=0;

RankingMenu();location='3';

printf("\nÇëÊäÈëÑ¡Ïî1 - 4 (µ±Ç°ÔÚÅÅÐò²Ëµ¥):");

continue;

}

if((ch=='3')&&(location=='3'))

{getchar();

printf("\n\t\t **ÏÖÔÚλÖÃÔÚÅÅÐò²Ëµ¥ -

×Ü·ÖÅÅÐò**\n");

printf("\n\t ** 'y'=ʹÓõ±Ç°ÎļþÃû

'n'=ÊäÈëÐÂÎļþÃû** : ");

if((ch=getchar())=='y')

{}

/*×·¼ÓÎĵµ*/

else Inputfilename();

fp=readfile();

/*¶ÁÈ¡Îĵµ*/

ffp=readfile2();

/*(¿ª´ò·½Ê½'¶Á'**'ÒýÓöÁÎļþÃû')¶ÁÎļþ¸¶±¾*/

temp1=ReadComputer2Two(ffp);

/*¶Á³ö¸¶±¾ÖеÄÊý¾Ý£¨¶þ½øÖÆ·½Ê½£©*/

fclose(ffp);



ReadComputer2(temp1,fp);

/*(2·½Ê½)Êý¾ÝдÈë»úÆ÷*/

fclose(fp);

Amount_ranking(temp1);

/*ÊýѧÅÅÐòº¯Êý*/

temp1=0;temp2=0;

RankingMenu();location='3';

printf("\nÇëÊäÈëÑ¡Ïî1 - 4 (µ±Ç°ÔÚÅÅÐò²Ëµ¥):");

continue;

}

if((ch=='4')&&(location=='3'))

{MainMenu();location='1';

printf("\nÇëÊäÈëÑ¡Ïî1 - 6 (µ±Ç°ÔÚÖ÷²Ëµ¥):");

break;

}

}

}

if((ch=='5')&&(location=='1'))

{InquireMenu();location='4';

printf("\nÇëÊäÈëÑ¡Ïî1 - 6 (µ±Ç°ÔÚ²éѯ²Ëµ¥):");

while((ch=getchar())!='0'){

if((ch=='1')&&(location=='4'))



{getchar();

printf("\n\t\t **ÏÖÔÚλÖÃÔÚ²éѯ²Ëµ¥ -

ѧºÅ²éѯ**\n");

printf("\n\t ** 'y'=ʹÓõ±Ç°ÎļþÃû

'n'=ÊäÈëÐÂÎļþÃû** : ");

if((ch=getchar())=='y')

{}

/*×·¼ÓÎĵµ*/

else Inputfilename();

Num_inquire();

/*ѧºÅ²éѯ*/

InquireMenu();location='4';

printf("\nÇëÊäÈëÑ¡Ïî1 - 6 (µ±Ç°ÔÚ²éѯ²Ëµ¥):");

continue;

}

if((ch=='2')&&(location=='4'))

{getchar();

printf("\n\t\t **ÏÖÔÚλÖÃÔÚ²éѯ²Ëµ¥ -

ÐÕÃû²éѯ**\n");

printf("\n\t ** 'y'=ʹÓõ±Ç°ÎļþÃû

'n'=ÊäÈëÐÂÎļþÃû** : ");

if((ch=getchar())=='y')

{}

/*×·¼ÓÎĵµ*/

elseInputfilename();



Name_inquire();

/*ÐÕÃû²éѯ*/

InquireMenu();location='4';

printf("\nÇëÊäÈëÑ¡Ïî1 - 6 (µ±Ç°ÔÚ²éѯ²Ëµ¥):");

continue;

}

if((ch=='3')&&(location=='4'))

{getchar();

printf("\n\t\t **ÏÖÔÚλÖÃÔÚ²éѯ²Ëµ¥ -

Êýѧ³É¼¨²éѯ**\n");

printf("\n\t ** 'y'=ʹÓõ±Ç°ÎļþÃû

'n'=ÊäÈëÐÂÎļþÃû** : ");

if((ch=getchar())=='y')

{}

/*×·¼ÓÎĵµ*/

else Inputfilename();

Math_inquire();

/*Êýѧ²éѯ*/

罿 InquireMenu();location='4';

printf("\nÇëÊäÈëÑ¡Ïî1 - 6 (µ±Ç°ÔÚ²éѯ²Ëµ¥):");

continue;

}

if((ch=='4')&&(location=='4'))

{getchar();

printf("\n\t\t **ÏÖÔÚλÖÃÔÚ²éѯ²Ëµ¥ -



C³É¼¨²éѯ**\n");

printf("\n\t ** 'y'=ʹÓõ±Ç°ÎļþÃû

'n'=ÊäÈëÐÂÎļþÃû** : ");

if((ch=getchar())=='y')

{}

/*×·¼ÓÎĵµ*/

else Inputfilename();

C_inquire();

/*C²éѯ*/

InquireMenu();location='4';

printf("\nÇëÊäÈëÑ¡Ïî1 - 6 (µ±Ç°ÔÚ²éѯ²Ëµ¥):");

continue;

}

if((ch=='5')&&(location=='4'))

{getchar();

printf("\n\t\t **ÏÖÔÚλÖÃÔÚ²éѯ²Ëµ¥ -

×Ü·Ö²éѯ**\n");

printf("\n\t ** 'y'=ʹÓõ±Ç°ÎļþÃû

'n'=ÊäÈëÐÂÎļþÃû** : ");

if((ch=getchar())=='y')

{}

/*×·¼ÓÎĵµ*/

else Inputfilename();

Amount_inquire();

/*×Ü·Ö²éѯ*/

InquireMenu();location='4';



}

printf("\nÇëÊäÈëÑ¡Ïî 1 - 6 (µ±Ç°ÔÚ²éѯ²Ëµ¥):");

continue;

}

if((ch=='6')&&(location=='4'))

{MainMenu();location='1';

printf("\nÇëÊäÈëÑ¡Ïî 1 - 6 (µ±Ç°ÔÚÖ÷²Ëµ¥):");

break;

}

}

}

}



以下无正文

仅供个人用于学习、研究;不得用于商业用途。

Forpersonal use only in study and research; not for commercial use.

仅供个人用于学习、研究;不得用于商业用途。

Nurfür den persönlichen für Studien, Forschung, zu kommerziellenZwecken verwendet werden.

Pourl 'étude et la recherche uniquement à des fins personnelles; pas àdes fins commerciales.

仅供个人用于学习、研究;不得用于商业用途。

толькодля людей, которые используются дляобучения, исследований и не должныиспользоваться

вкоммерческих целях.

显示全文