當前位置:成語大全網 - 漢語詞典 - c語言字典合並

c語言字典合並

# include & ltstdio.h & gt

# include & ltstring.h & gt

int main()

{

FILE * FP 1 = NULL;

FILE * fp2 = NULL

FILE * fp3 = NULL

char buf 1[100]= { 0 };

char buf 2[100]= { 0 };

char buf 3[200]= { 0 };

int I;

int j;

int長度;

炭化溫度;

fp1 = fopen("A.txt "," r ");

fp2 = fopen("B.txt "," r ");

fp3 = fopen("C.txt "," w ");

fgets(buf1,99,FP 1);

fgets(buf2,99,fp2);

strcpy(buf3,buf 1);

strcat(buf3,buf 2);

length = strlen(buf 3);

for(I = 0;我& lt長度-1;i++)

{

for(j = I+1;j & lt長度;j++)

{

if(buf 3[I]& gt;buf3[j])

{

temp = buf 3[I];

buf 3[I]= buf 3[j];

buf 3[j]= temp;

}

}

}

fputs(buf3,fp3);

fclose(fp3);

fclose(fp2);

fclose(FP 1);

返回0;

}