若有以下程序段 double x=5.16894; printf("%fn", (int)(x*1000+0.5)/(double)1000 ); 则程序段的输出结果是()A.5.170000B.5.175000C.5.169000D.5.168000
若有以下程序段 double x=5.16894; printf("%fn", (int)(x*1000+0.5)/(double)1000 ); 则程序段的输出结果是()
A.5.170000
B.5.175000
C.5.169000
D.5.168000
参考答案和解析
B (int)(x*1000+0.5)/(double)1000表达式功能,保存数据x的后三位小数,把第四位四舍五入。
相关考题:
若有以下函数首部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 *);
(15)程序段:int x=12; double y=3.141593; printf(“%d%8.6f”,x,y);的输出结果是A)123.141593 B)12 3.141593 C)12,3.141593 D)123.141593
下列程序的输出结果是main(){ double d=3.2; int x,y;x=1.2; y=(x+3.8)/5.0;printf("%d\n", d*y);}A.3B.3.2C.0D.3.07
以下程序的输出结果是______。 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;}
下面程序段的输出结果是()。includemain(){float x=1.236547;printf("%f\n",(int)(x*10 下面程序段的输出结果是( )。 #include<stdio.h> main() {float x=1.236547; printf("%f\n",(int)(x*1000+0.5)/(float)1000); }A.1.237000B.输出格式说明与输出项不匹配,输出无定值C.1.236000D.1.24
有以下程序 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); } 程序运行后的输出结果是( )。
下列程序运行后的输出结果是( )。#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.程序有误
下列程序的输出结果是()。includemain(){double d=3.2;int x,y; x=1.2;y=(x+3.8)/5.0; 下列程序的输出结果是( )。 #include <8tdio.h> main() { double d=3.2; int x,y; x=1.2;y=(x+3.8)/5.0; printf("%d\n",d*y); }A.3B.3.2C.0D.3.07
下列程序的输出的结果是( )。 main { double d=3.2;int x,Y; x=1.2;v=(x+3.8)/5.0; printf("%d\n",d*y); }A.3B.3.2C.0D.3.07
以下程序的输出结果是【】。 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;}
设有定义:doublex=5.16894;,则语句prinff(”%If\n”,(int)(x$1000+0.5)/1000.);的输出结果是( )。A.5.16900B.5.16800C.0.00000D.输出格式说明符与输出项不匹配,产生错误信息
有以下程序: #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
程序段:int x=12;double y=3.141593;printf(”%d%8.6f”,x,y.;的输出结果是( )。A.123.141593SX 程序段:int x=12;double y=3.141593;printf(”%d%8.6f”,x,y.;的输出结果是( )。A.123.141593B.12 3.141593C.12,3.141593D.123.1415930
有以下程序:includemain(){int a;char c=10; float f=100.0;double x; a=f/=c*=(x=6.5 有以下程序: #include <stdio.h> main() { int a; char c=10; float f=100.0; double x; a=f/=c*=(x=6.5); printf("%d%d%3.1f%3.1f\n",a,c,f,x); } 程序运行后的输出结果是( )。A.1 65 1 6.5B.1 65 1.5 6.5C.1 65 1.0 6.5D.2 65 1.5 6.5
下列程序的输出结果是______。 include main() { double d=3.2;int x,y; x=1.2;y=(x+3. 下列程序的输出结果是______。 #include<stdio.h> main() { double d=3.2;int x,y; x=1.2;y=(x+3.8)/5.0; printf("%d\n",d*y); }A.3B.3.2C.0D.3.07
试题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
(6)以下程序运行后的输出结果是 【6】 。#include stdio.hmain(){ int a;a=(int)((double)(3/2)+0.5+(int)1.99*2);printf("%d\n",a);}
以下程序段的执行结果是(). double x;x=218.82631; printf("%-6.2f/n",x);A、输出格式描述符的域宽不够,不能输出B、输出为21.38e+01C、输出为218.83D、输出为218.82631
单选题若有以下函数首部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);
单选题程序段:int x=12;double y=3.141593;printf(%d%8.6f,x,y);输出结果是( )。A123.141593B123.141493C12,3.141593D123.1415930
单选题有以下程序#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
单选题有以下程序:#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