用c语言将已有两个文件test1.txt和test2.txt文件的数据,合并后存放到文件te

2024-11-24 00:37:06
推荐回答(2个)
回答1:

boolcheck(){FILE*fp=fopen("d:\\test.txt","租友r");//打开文件if(!fp){printf("can'仔槐topend:\\tetxt.txt!\弊戚槐n");return-1;}intrecord_num,total_money;intid,type,money,date;intrecord_num_t=0,total_money_t=0;fscanf(fp,"%d%d",&record_num,&total_money);//读入交易总金额与交易数while(fscanf(fp,"%d%d%d%d",&id,&type,&money,&date)==4)//读入每条记录{++record_num_t;total_money_t+=money;}fclose(fp);if(record_num_t==record_num&&total_money_t==total_money)//比较returntrue;returnfalse;}

回答2:

合并的规则是怎么样的?