未知题型
有如下程序 #include<iostream> #include<iomanip> using namespace std; int main(){ cout<<setprecision(3)<<fixed<<setfill('*')<<setw(8); cout<<12.345<<_______<<34.567; return 0; } 若程序的输出是: ** 12.345**34.567 则程序中下划线处遗漏的操作符是
A.setprecision(3)
B.fixed
C.setfill('*')
D.setw(8)
- A.345<<_______<<34.567;
B.345**34.567
C.setprecision(3)
B.fixed
C.setfill('*')
【参考答案】
D
解析:本题考查的是输出的格式控制。本例中,操作符setprecision的作用是设置浮点数的精度;操作符fi......
(↓↓↓ 点击下方‘点击查看答案’看完整答案 ↓↓↓)
点击查看答案
相关考题
-
判断题
生态空间是国土空间的重要组成,是以提供生态产品为主体功能的国土空间,具体包括森林、草原、湿地、河流、湖泊、滩涂、自然岸线、海洋、荒地、荒漠、冰川等。正确错误 -
未知题型
有如下程序: #include <iostream> using namespace std; class Obj { static int i; public: Obj( ){i++;} ~Obj(){i--;} static int getVal( ){ return i;} }; int Obj::i=0; void f() {Obj ob2; cout<<ob2.getVal( ); } int main( ){ Obj ob1; f(); Obj *ob3=ew Obj; cout<<ob3->getVal( ); delete ob3; cout<<Obj::getVal( ); return 0; } 程序的输出结果是A.232B.231C.222D.221
A.getVal(
B.232
B.231
C.222 -
未知题型
有如下程序 #include <iostream> using namespace std; class Base { protected: Base( ){cout<<'A'; } Base(char c) { cout<<c; } }; class Derived: public Base { public: Derived(char c){ cout<<c; } }; int main( ){ Derived d1 ('B'); return 0; } 执行这个程序屏幕上将显示输出D.BB
A.B
B.BA
C.AB
