题目
有如下程序:#include <iostream>using namespace std;class point{ int x, y;public: point(int vx, int vy ) { x = vx; y = vy; } point () x = 0; y= 0; } point operator+(point p1 ) { point p; int px = x+ p1.x; int py = y + p1.y; return point(px, py ); point operator-(point p1 ) { point p; int px = x -p1.x; int py = y - p1.y; return point (px, py ); } void print() { cout<<x<<" , "<<y<<end1; }};int main (){ point p1(10, 10 ), p2(20, 20 ); p1 = p1 - p2; p1.print (); return 0;} 执行后的输出结果是
A.10,10
B.20,20
C.10,20
D.30,30
第1题
有如下程序: #include<iost earn> using namespace std; class TestClass{ protected: TestClass(){cout<<'x';} TestClass(char C) {cout<<c;} }; class TestClass1:public TestClass { public: TestClass1(char C) {Cout<<c;) }; int main(){ TestClass1 d1('y'); return 0; } 执行这个程序,屏幕上将显示输出()。
A.y
B.yx
C.xy
D.yy
第2题
若有以下程序: #include <iost ream> using namespace std; class A { private: int a; public: A(int i) { a=i; } void disp () { cout<<a<<", "; } }; class B { private:
A.10,10,10
B.10,12,14
C.8,10,12
D.8,12,10
第5题
有如下程序 #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)
第6题
有如下程序: #include<iostream> using namespace std; int main() { cout.fill('*') cout.width(6); cout.fill('#') cout<<123<<endl; return 0; } 执行后的输出结果是
A.###123
B.123###
C.***123
D.123***
第7题
有如下程序: #include <iostream> #include <iomanip> using namespace std; int main() { cout.fill('*'); cout.width(6); cout.fill('#'); cout<<123<<end1; return 0; } 执行生的输出结果是()。
A. ###123
B.123###
C. ***123
D.123***
第8题
有如下程序:
#include<iomanip>
#include<iostream>
using namespace std;
int main(){
cout<<setfill('*')<<setw(6)<<123<<456;
return 0;
}
运行时的输出结果是()。
A) ***123***456
B) ***123456***
C) ***123456
D) 123456
第9题
有如下程序: #include <iostream> using namespace std; class AA { public: virtual void f() { cout<< "AA"; } }; class BB : public AA { public: BB() { cout << "BB"; } }; cla
A.AA
B.AABBCC
C.BBAABBCC
D.BBBBAACC
第10题
有如下程序:#include <iostream>#include<iomanip>using namespace std;int main(){ cout.fill('*'); cout.width(6); cout.fill('#'); cout<<123<<end1; return 0;}执行后的输出结果是()。
A.###123
B.123###
C.***123
D.123***
第11题
?有如下程序:
include(iostream.h>
include<stdlib.h>
classTestClass
{
public:
intX,y;
TestClass(){x=y=0;}
TestClass(inta,intb){x=a;y=b;}
voiddisp()
{
cout<<"x="<<x<<",y="<y<<endl;
}
};
voidmain()
{
TestClasss1(2,3);
s1.disp();
}
程序执行后的输出结果是()。
A.100
B.000
C.010
D.001
为了保护您的账号安全,请在“赏学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!