下面程序的功能是:从键盘输入若干整数,若输入-1则结束输入,将其中的偶数写入文本文件d3.txt中,请填空。
#include
#include
int main(void)
{ int x;
(1) ;
if((fp=fopen("d3.txt","w"))==NULL)
{ printf("Cannot open file!");
exit(0);
}
scanf("%d",&x);
while( (2) )
{ if(x%2==0)
(3) ;
(4) ;
}
fclose(fp);
}
#include
#include
int main(void)
{ int x;
(1) ;
if((fp=fopen("d3.txt","w"))==NULL)
{ printf("Cannot open file!");
exit(0);
}
scanf("%d",&x);
while( (2) )
{ if(x%2==0)
(3) ;
(4) ;
}
fclose(fp);
}