题目内容

有以下程序
#include <stdio.h>
main()
{ FILE *fp; int i;
char ch[]="abcd",t;
fp=fopen("abc.dat","wb+");
for(i=0; i<4; i++) fwrite(&ch[i],1,1,fp);
fseek(fp,-2L,SEEK_END);
fread(&t,1,1,fp);
fclose(fp);
printf("%c\n",t);
}
程序执行后的输出结果是

A. d
B. c
C. b
D. a

查看答案
更多问题

下面程序的运行结果是: 【 17 】 。
#include <stdio.h>
int f(int a[],int n)
{ if(n>1)
return a[0] + f(a+1, n-1);
else
return a[0];
}
main()
{ int aa[10]={1,2,3,4,5,6,7,8,9,10}, s;
s = f(aa+2,4); printf("%d\n", s);
}

以下程序中,函数 fun 的功能是计算 x 2-2x+6 ,主函数中将调用 fun 函数计算:
y1=(x+8) 2-2 (x+8)+6
y2=sin 2(x)-2sin(x)+6
请填空。
#include "math.h"
double fun(double x){ return (x*x-2*x+6); }
main()
{ double x,y1,y2;
printf("Enter x:"); scanf("%lf",&x);
y1=fun(【 11 】 );
y2=fun(【 12 】 );
printf("y1=%lf,y2=%lf\n",y1,y2);
}

以下程序的功能是:将输入的正整数按逆序输出。例如:若输入 135 则输出 531 。请填空。
#include <stdio.h>
main()
{ int n,s;
printf("Enter a number : "); scanf("%d",&n);
printf("Output: ");
do
{ s=n%10; printf("%d",s); 【 10 】 ; }
while(n!=0);
printf("\n");
}

以下程序运行后的输出结果是 【 8 】 。
main()
{ int x,a=1,b=2,c=3,d=4;
x=(a<b)?a:b; x=(x<c)?x:c; x=(d>x) ? x : d;
printf("%d\n",x);
}

答案查题题库