单选题有以下程序:#includefloat fun(double a){ double x; x=a-(int)a; return x;}main(){ double a=3.1415; printf(%f,fun(a));}程序的运行结果是(  )。A3.000000B3.141500C0.141500D0.000000

单选题
有以下程序:#includefloat fun(double a){ double x; x=a-(int)a; return x;}main(){ double a=3.1415; printf(%f,fun(a));}程序的运行结果是(  )。
A

3.000000

B

3.141500

C

0.141500

D

0.000000


参考解析

解析:
在fun函数中,x=a-(int)a表示x取值为a的小数部分,因此,输入a为3.1415,输出x=0.141500。答案选择C选项。

相关考题:

若有以下函数首部int fun(double x[10], int *n)则下面针对此函数的函数声明语句中正确的是A)int fun(double x, int *n);B)int fun(double , int );C)int fun(double *x, int n);D)int fun(double *, int *);

有以下程序int fun1(double a){return a*=a;}int fun2(double x,double y){ double a=0,b=0;a=fun1(x);b=fun1(y);return(int)(a+b);}main(){ double w; w=fun2(1.1,2.0); …… }程序执行后变量 w 中的值是A)5.21B)5C)5.0D)0.0

以下程序的输出结果是______。 include int add(int x, int y) { return x+y; } doub 以下程序的输出结果是______。include<iostream.h>int add(int x, int y){return x+y;}double add(double x, double y){return x+y;}void main(){int a=3, b=3;double c=6.5, d=1.5;cout<<add(a, b)<<","<<add(c, d)<<end1;}

有以下程序#include stdio.htypedef struct{ int num;double s ; }REC;void fun1( REC x ){x.num=23; x.s=88.5;}main(){ REC a={16,90.0 };fun1(a);printf("%d\n",a.num);}程序运行后的输出结果是 【 1 4 】 。

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

阅读下面程序,则程序执行后的结果为#include "stdio.h"main(){int a=4,b=6,c=7;double d,fun(int,int,int);d=fun(a,b,c);printf("%lf\n",d);}double fun(int a,int b,int c){double s;s=a%b*c;return s;}A.27B.27.000000C.28D.28.000000

以下正确的函数头定义形式是A.double fun(int x,int y)B.double fun(int x;int y)C.double fun(int x,int y);D.double fun(int x,y);

以下正确的函数原型语句是( )。A、double fun(int x,int y)B、double fun(int x;int y)C、double fun(int,int);D、double fun(int x,y);

以下正确的函数原型语句是(48)。A.double fun(int x,int y);B.double fun(int x;int y);C.double fun(int,int);D.double fun(int x,y);

有以下程序 include typedef struct { int num;double s; }REC; void funl(REC *x) { x 有以下程序 include<stdio.h> typedef struct { int num;double s; }REC; void funl(REC *x) { x->num=23;x->s=88.5; } void main() { REC a={16,90.0}; fun1(A); printf("%d\n",a.num); } 程序运行后的输出结果是( )。

分析以下程序执行结果【】。 include int f (int x, int y){return x,y; } double f (d 分析以下程序执行结果【 】。include<iostream.h>int f (int x, int y){return x,y;}double f (double x, double y) {return x,y;}void main() {int a=4, b=6;double c=2.6, d=7.4;cout<<f (a, b) <<","<<f (c, d) <<end1;}

有下列程序: int funl(double a){return a*=a;} int fun2(double x,double y) {double a=0,b=0; a=funl(x);b=funl(y);return(int)(a+b); } main( ) {double w;w=fun2(1.1,2.0),……} 程序执行后变量w中的值是( )。 、A.5.21B.5C.5.0D.0.0

下列程序运行后的输出结果是( )。#includeusing namespace std;int fun(int x) { return x*x; }double fun(double x,int y=2) { return x*y; }int main(){int a=5;double b= 1.2;cout}A. 27.4B.26.44C. 12.4D.程序有误

有以下程序includefloat fun(int x,int y){return(x+y);}void main( ){int a=2,b=5 有以下程序 #include<iostream.h> float fun(int x,int y) {return(x+y);} void main( ) {int a=2,b=5,c=8; cout<<fun((int)fun(a+c,b) ,a-c) ;}程序运行后的输出结果是A.编译出错B.9C.21D.9

有以下程序:includeFloat fun(int x, int y){return(x+y) ;}void main( ){int a=2, 有以下程序: #include<iostream.h> Float fun(int x, int y) { return(x+y) ;} void main( ) { int a=2,b=5,c=8; cout < < fun((int) fun(a+c, b) ,a-c) ;} 程序运行后的输出结果是A.编译出错B.9C.21D.9.0

有以下程序:includefloat fun(int x,int y){return(x+y);}main(){int a=2,b=5,c=8; pr 有以下程序: #include<stdio.h> float fun(int x,int y) { return(x+y); } main() { int a=2,b=5,c=8; printf("%3.0f\n",fun((int)fun(a+c,b),a-c)); } 程序运行后的输出结果是( )。A.编译出错B.9C.21D.9

若有以下函数首部: int fun(double x[10],int *n) 则下面针对此函数的函数声明语句中正确的是( )。A.int fun(double x, int *n);B.int fun(double, int);C.int fun(double *x, int n);D.int fun(double*, int*);

有以下程序:int fun1 (double a){ return a * =a;}int fun2 ( double x, double y ){ double a=0,b=0; a = fun1 (x) ;b = fun1 (y); return(int) (a + b);} main() { doublew;w=fun2(1.1,2.0);……} 程序执行后变量w中的值是( )。A.5.21B.5C.5D.0

有以下程序:includeint fun(int x,int y){if(x==y)return(x);else return((x+y)/2);}m 有以下程序: #include<stdio.h> int fun(int x,int y) {if(x==y)return(x); else return((x+y)/2); } main() {int a=1,b=2,c=3; printf("%d\n",fun(2*a,fun(b,C))); } 程序运行后的输出结果是( )。A.2B.3C.4D.5

以下程序的输出结果是【】。 include int add(int x,int y) { retum X+y; } dOuble ad 以下程序的输出结果是【 】。include<iostream.h>int add(int x,int y){retum X+y;}dOuble add(dOUble x,double y){return x+y;}void main(){int a=4,b=6;double c=2.6,d=7.4;cout<<add(a,b)<<",”<<add(C,d)<<endl;}

有以下程序: #includestdio.h double f(double x); main( ) {double a=0; int i; for(i=0;i30;i+=10)a+=f((double)i); printf("%5.of\n",a); } double f(double x) { return x*x+1; } 程序运行后的输出结果是( )。A.503B.401C.500D.1404

有以下程序#includestdio.hdouble f(double x);main(){ double a=0;int i;for(i=0;i30;i+=10) a+=f((double)i);printf("%5.0f\n",a);}double f(double x){return x*x*i;}程序运行后的输出结果是A.503B.401C.500D.1404

试题24有以下程序#include stdio.hdouble f(double x);main(){ double a=0; int i;for(i=0;i30;i+=10) a+=f((double)i);printf(“%5.0f\n”, a);}double f(double x){ return x*x+1;}程序运行后的输出结果是()A.503B.401C.500D.1404

以下正确的函数定义形式是()。A、double FUN(int x;int y)B、double FUN(int x,int y)C、double FUN(int x,int y);D、double FUN(int x,y)

单选题若有以下函数首部int fun(double x[10],int*n)则下面针对此函数的函数声明语句中正确的是(  )。Aint fun(double*,int*);Bint fun(double,int);Cint fun(double *x,int n);Dint fun(double x,int*n);

单选题有以下程序#includeint fun1(double a){ return (int)(a*= a);}int fun2(double x,double y){ double a = 0,b = 0; a = fun1(x); b = fun1(y); return (int)(a+b);}main(){ double w; w = fun2(1.1,2.0); printf(%4.2f,w);}程序执行后输出结果是(  )。A5B5.00C5.21D0.0

单选题有以下程序 int fun1(double a) { return a*=a; } int fun2(double x,double y) { double a=0,b=0; a=fun1(x); b=fun1(y); return(int)(a+b); } main() { double w; w=fun2(1.1,2.0); } 程序执行后变量w中的值是()A5.21B5C5.0D0.0