题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2023-12-23 19:40:16

[单项选择]有如下程序: #include using namespace std; class Boat; class Car{ public: Car(int i):weight(i){ } friend int Total(const Car &c.const Boat &b); //① private: int weight; }; class Boat{ public: Boat(int i):weight(i){ } friend int Total(const Car &c,const Boat &b); private: int weight; }; int Total(const Car &c,const Boat &b){ //② return c.weight+b.weight; } int main( ){ Car c(10); Boat b(8); cout<<"The total weight is"<A. 程序编译正确
B. 程序编译时语句①出错
C. 程序编译时语句②出错
D. 程序编译时语句③出错

更多"有如下程序: #include "的相关试题:

[单项选择]有如下程序: #include<iostream> using namespace std; class Base{ int x; public: Base(int n=0):x(n){cout<<n;) int getX( )const{return x;} }; class Derived:public Base{ int y; public: Derived(int m,int n):y(m,)Base(n){cout<<m;} Derived(int m):y(m){cout<<m;} }; int main( ){ Derived d1(3),d2(5,7) return 0; } 运行时的输出结果是
A. 375
B. 357
C. 0375
D. 0357
[单项选择]下列程序的输出结果是 #include"iostream" using namespace std; int Max(int a,int b) { if(a>b) return a; else return b; } void main( ) { int m,n; m=10,n=5; int max = Max(m,n); cout<<max<<endl; }
A. 10
B. 程序有误
C. 1
D. 0
[单项选择]下面程序的执行结果为 #include"iostream" using namespace std; class A { int a; public: void Seta(int x){a=x;} void Display_a( ){cout<<a<<endl;} }; class B { int b; public: void Setb(int x){b=x;} void Dispaly-b( ) {cout<<b<<endl;} }; class C://public A,private B { private: int c; public: void Setc(int x,int y,int z) {c=z;Seta(x);Setb(y);} void Display_c( ){ cout<<c<<endl;} }; ①void main( ) ② { ③ C cc; ④ cc.Seta(1); ⑤ cc.Display_a( ); ⑥ cc.Setc(2,2,3); ⑦ cc.Dispaly-b( ); ⑧ cc.Display_c( ); }
A. 输出为2 2 3
B. 有错误在第5行
C. 输出为1 2 3
D. 有错误在第7行
[简答题]有如下程序 #include #include using namespace std; class MyClass{ public: MyClass( ){cout<<’A”;} MyClass(char c {cout<A. A.ABX
B.ABXB
C.AXB
D.AXBB

[单项选择]有如下程序: #include #include using namespace std; int main( ){ cout<A. ##OK123
B. ##OK#123
C. OK##123
D. OK##123#
[单项选择]有如下程序 #include using namespace std; class Base{ protected: Base( ){cout<<′A′;} Base(char C){cout<A. B
B. BA
C. AB
D. BB
[单项选择]有如下程序: #include using namespace std; class Media{ public: void Name( ); void Show( ); protected: int page; }; class Book:private Media{ public: void Print( ){cout<A. 语句①
B. 语句②
C. 语句③
D. 语句④
[单项选择]有如下程序: #include using namespace std; class XX{ int x; public: XX(int xx=0):x(xx){} int getX( ){return x;} }; class YY:public XX{ int y; public: YY(int xx,int yy):x(xx),y(yy){} int getV( ){return getX( )+y;} }; int main( ){ YY c(3,4); cout<A. 3
B. 4
C. 7
D. 10

我来回答:

购买搜题卡查看答案
[会员特权] 开通VIP, 查看 全部题目答案
[会员特权] 享免全部广告特权
推荐91天
¥36.8
¥80元
31天
¥20.8
¥40元
365天
¥88.8
¥188元
请选择支付方式
  • 微信支付
  • 支付宝支付
点击支付即表示同意并接受了《购买须知》
立即支付 系统将自动为您注册账号
请使用微信扫码支付

订单号:

请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码