以下程序运行后,data.txt文件中的内容是()#include "stdio.h"int main(){FILE *fp;int a=15,b;fp=fopen("d:\\data.txt","w");fprintf(fp,"%d,",a);b=a+10;fprintf(fp,"%d\n",b);fclose(fp);getch();return 0;}
A: 15
B: 25,15
C: 15,25
D: 25
A: 15
B: 25,15
C: 15,25
D: 25
举一反三
- 以下程序运行后,data.txt文件中的内容是() #include "stdio.h" int main() {FILE *fp; int a=15,b; fp=fopen("d:\data.txt","w"); fprintf(fp,"%d,",a); b=a+10; fprintf(fp,"%d ",b); fclose(fp); getch(); return 0; }
- 以下程序执行后,文件test.txt的内容是() #include void main() { FILE *fp; fp=fopen(“test.txt”,”w”); fprintf(fp,”%s”,”How ”); fclose(fp); fp=fopen(test.txt“,”a”); fprintf(fp,”%s”,”are you!”); fclose(fp); }
- 下面程序的输出结果是________。#include<;stdio.h>;int main( ){ FILE *fp; int n,a[2]={65,66}; char ch; fp=fopen("d.dat","w"); fprintf(fp,"%d%d",a[0],a[1]); fclose(fp); fp=fopen("d.dat","r"); fscanf(fp,"%c",&ch); n=ch; while(n!=0){printf("%d",n%10);n=n/10;} fclose(fp); return 0;}
- 有以下程序:#include [stdio.h] main() { FILE *fp; int a[10]={1,2,3}, i, n; fp = fopen("d1.dat", "w"); for (i=0; i<3; i++) fprintf(fp, "%d", a[i]); fprintf(fp, "\n"); fclose(fp); fp = fopen("d1.dat", "r"); fscanf(fp, "%d", &n); fclose(fp); printf("%d\n", n); }程序的运行结果是()。[/i]
- 有以下程序:#include [stdio.h] main() { FILE *fp; int a[10]={1,2,3}, i, n; fp = fopen("d1.dat", "w"); for (i=0; i<3; i++) fprintf(fp, "%d", a[i]); fprintf(fp, "\n"); fclose(fp); fp = fopen("d1.dat", "r"); fscanf(fp, "%d", &n); fclose(fp); printf("%d\n", n); }程序的运行结果是()。[/i] A: 321 B: 12300 C: 1 D: 123