请在程序的下划线处填入正确的内容并把下划线删除, 使程序得出正确的结果。
注意:源程序存放在考生文件夹下BLANK1.C中。
不得增行或删行,也不得更改程序的结构!
给定源程序:
#include
#include
void fun(char *s, int a, double f)
{
/**********found**********/
__1__ fp;
char str[100], str1[100], str2[100];
int a1; double f1;
fp = fopen("file1.txt", "w");
fprintf(fp, "%s %d %f\n", s, a, f);
/**********found**********/
__2__ ;
fp = fopen("file1.txt", "r");
/**********found**********/
fscanf(__3__,"%s%s%s", str, str1, str2);
fclose(fp);
a1 = atoi(str1);
f1 = atof(str2);
printf("\nThe result :\n\n%s %d %f\n", str, a1, f1);
}
main()
{char a[10]="Hello!"; int b=12345;
double c= 98.76;
fun(a,b,c);
}
解题答案:
/**********第一空**********/
FILE* fp;
/**********第二空**********/
fclose(fp) ;
/**********第三空**********/
fscanf(fp,"%s%s%s", str, str1, str2);
******************************************
相关专题:
编辑推荐: