有以下程序 #include double fun(double s,double a,double b) { a = (int)(s); b = s-a; return a+b; } main ( ) { double s=12.654,a=11,b=22; printf("%5.2lf,",fun(s,a,b)); printf("%5.2lf,%5.2lf\n",a,b); }程序运行后的输出结果是
举一反三
- 有以下程序#include <stdio.h>double fun(double a){ double x;x = a - (int)a;return x;}main(){ double a = 3.1415;printf("%f\n", fun(a));}程序的运行结果是______。 A: 0.141500 B: 3.141500 C: 3.000000 D: 0.000000
- 有以下程序,请在横线处填写正确语句,使程序可正常编译运行。[br][/br] #include ; main() { double x,y,(*p)(); scanf("%lf%lf",&x,&y); p=avg; printf("%f\n",(*p)(x,y)); } double avg(double a,double b) { return((a+b)/2);}
- __________________(double,double);main(){doublex,y;scanf("%lf%lf",&x,&y);printf("%lf",max(x,y));}doublemax(doublea,doubleb){return(a>b?a:b);}
- 4.2()设有double()x;()char()s[50];()输出双精度浮点数x和字符串s,正确的语句是()。()(2.0分)A.()printf("%lf()%s",x,s);()B.()printf("%ld()%s",x,s);()C.()printf("%lf()%s",&x,s);()D.()printf("%lf()%s",x,s[50]);
- 有以下程序段,输出结果为()。 #include <stdio.h> struct s { int a; char b; double f; }; main() { printf("%d",sizeof(struct s)); }