下面程序的输出结果是________。#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;}
举一反三
- 下列程序的输出结果是____。[br][/br]intmain(void){[br][/br]FILE*fp;[br][/br]intn,a[2]={65,66};[br][/br]charch;[br][/br]fp=fopen("d.dat","w");[br][/br]fprintf(fp,"%d%d",a[0],a[1]);[br][/br]fclose(fp);[br][/br]fp=fopen("d.dat","r");[br][/br]fscanf(fp,"%c",&ch);[br][/br]n=ch;[br][/br]while(n!=0){[br][/br]printf("%d",n%10);[br][/br]n=n/10;[br][/br]}[br][/br]fclose(fp);[br][/br]return0;}
- 有以下程序:#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
- 有以下程序:#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
- 有以下程序:#include stdio.hmain(){ FILE *fp; int a[10]={1,2,3}, i, n;fp = fopen(d1.dat, w);for (i=0; i3; 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