单项选择题
要利用C++流实现输入输出的各种格式控制,必须在程序中包含的头文件是______。
A.fstream
B.istream
C.ostream
D.iomanip
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
单项选择题
有如下程序: #include<iostream> #include<string> using namespace std; class Instrument public: Instrument(string t= 乐器 ,string n= 无名 ):type(t),name(n) virtual string GetType() constreturn 乐器 ; virtual string GetName() constreturn 无名 ; protected: stnng type,name; ; class Piano:public Instrument public: Piano(string n,string t= 钢琴 ):lnstrument(t,n) string CetType() constreturn 钢琴 ; string GetName() constreturn name; ; int main() Instrument * pi=new Piano( 星空 ); cout<<pi->GetType()<<’-’<<pi->GetName(); delete pi; return 0; 运行时的输出结果是______。
A.钢琴-星空
B.钢琴-无名
C.乐器-星空
D.乐器-无名
点击查看答案&解析
单项选择题
有如下程序: #include<iostream> using namespace std; class Point public: Point(int xx=0,int yy=0):x(xx),y(yy) void SetX(int xx)x=xx; void SetY(int yy)y=yy; private: int x,y; ; class Circle:Point public: Circle(int r):radius(r) int GetRadius()return radius; private: void SetRadius(int r)radius=r; int radius; ; int main() Circle c1(5); c1.SetX(1); ① c1.SetY(2); ② c1.SetRadius(10); ③ cout<<c1.GetRadius(); ④ return 0; 在标注号码的语句行中不存在语法错误的是______。
A.①
B.②
C.③
D.④
点击查看答案&解析
相关试题
若目前D盘根目录下并不存在test.txt文件,...
下列模板声明中,有语法错误的是______。
下列关于模板的叙述中,错误的是______。