求大神,为什么最后一个计算结果会得不出呢?
程序代码:#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main()
{
int a, b, s;
FILE *fin1, *fin2, *fout;
fin1 = fopen("F:\\2017C\\test1.txt", "r");
if ((fin1 = fopen("F:\\2017C\\test1.txt", "r")) == NULL)
{
printf("can not to open the file!\n");
system("pause");
exit(1);
}
fin2 = fopen("F:\\2017C\\test2.txt", "r");
if ((fin2 = fopen("F:\\2017C\\test2.txt", "r")) == NULL)
{
printf("can not to open the file!\n");
exit(1);
}
fout = fopen("F:\\2017C\\test.txt", "w");
fscanf(fin1, "%d", &a);
fscanf(fin2, "%d", &b);
while (!feof(fin1) && !feof(fin2))
{
s = a + b;
fprintf(fout, "%d\n", s);
fscanf(fin1, "%d", &a);
fscanf(fin2, "%d", &b);
}
fclose(fin1);
fclose(fin2);
fclose(fout);
return 0;
}12 23 45 56 32 65 45 58 65 54 123 123 //test1.txt
1 1 1 1 2 2 2 2 3 3 3 3 //test2.txt
程序代码:13 24 46 57 34 67 47 60 68 57 126 //test.txt为什么最后一位会算不出来呢?








