色婷婷狠狠18禁久久YY,CHINESE性内射高清国产,国产女人18毛片水真多1,国产AV在线观看

C語言,兩個txt文件操作小程序,求代碼!100分?

錢諍諍2年前11瀏覽0評論

#include<stdio.h>

#include<stdlib.h>

#include<string.h>

voidmain()

{

FILE*fpa,*fpb,*fpc;

chark[300]={0},kk[300]={0};//k是b里的字符串,kk是a里的字符串

fpa=fopen("a.txt","r");

fpb=fopen("b.txt","r");

fpc=fopen("c.txt","w");//先把內(nèi)容存在文件c里,再轉(zhuǎn)到a里面

if(fpa==NULL||fpb==NULL)

{

printf("打開文件失敗\n");

printf("請確認(rèn)你是否已新建好\"a.txt\"和\"b.txt\"\n");

return;

}

fscanf(fpb,"%s",k);

fscanf(fpa,"%s",kk);

while(kk[0]!='\0')//開始刪除字符串

{

if(strcmp(kk,k)!=0)/*無相同內(nèi)容*/

{

fprintf(fpc,"%s\n",kk);

}

memset(kk,0,sizeof(kk));

fscanf(fpa,"%s",kk);

}

fclose(fpa);

fclose(fpb);

fclose(fpc);

fpc=fopen("c.txt","r");

fpa=fopen("a.txt","w");

memset(kk,0,sizeof(kk));

fscanf(fpc,"%s",kk);

while(kk[0]!='\0')//開始轉(zhuǎn)到a里面

{

fprintf(fpa,"%s\n",kk);

memset(kk,0,sizeof(kk));

fscanf(fpc,"%s",kk);

}

fclose(fpc);

system("delc.txt");//把新建的c.txt刪掉

printf("已完成\n");

}