题目内容 (请给出正确答案)
[主观题]

若有如下程序:#include<iostream>using namespace std;class TestClass1{private:int a;public:T

若有如下程序: #include<iostream> using namespace std; class TestClass1 { private: int a; public: TestClass1(int i) { a=i; } void disp() { cout<<a<<","; } }; class TestClass2 { private: int b; public: TestClass2(int j) { b=j; } void disp() { cout<<b<<","; } }; class TestClass3:public TestClass2,public TestClass1 { private: int c; public: TestClass3(int k):TestClass1(k-2),TestClass2(k+2) { c=k; } void disp() { TestClass1::disp(); TestClass2::disp(); cout<<c<<endl; } }; int main() { TestClass3 obi(10); obj.disp(); return 0; } 程序执行后的输出结果是()。

A.10,10,10

B.10,12,14

C.8,10,12

D.8,12,10

提问人:网友grantliping 发布时间:2022-01-06
参考答案
查看官方参考答案
如搜索结果不匹配,请 联系老师 获取答案
更多“若有如下程序:#include<iostream>using…”相关的问题
第1题
若有以下程序:#include <iost ream>using namespace std;class A{private: int a;public: A(int

若有以下程序: #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

点击查看答案
第2题
有如下程序:#include<iost earn>using namespace std;class TestClass{protected:TestClass(){co

有如下程序: #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

点击查看答案
第3题
若有如下程序:#include<iostream>using namespace std;class TestClass{public:void who(){cout<

若有如下程序: #include<iostream> using namespace std; class TestClass { public: void who(){cout<<“TestClass”<<endl;} }; class TestClassl:public TestClass { public: void who(){cout<<“TestClassl”<<endl; int main() { TestC

A.TestClassl

B.TestClass

C.0

D.无输出

点击查看答案
第4题
若有如下程序: include "stdio.h" main() { char s[30]; Strcpy(&S[0],"

若有如下程序: include "stdio.h" main() { char s[30]; Strcpy(&S[0],"adc"); Strcpy(&S[1],"def"); strcpy(&S[2],"gh");; printf("%S\n",s); 则程序运行后的输出结果是【 】。

点击查看答案
第5题
若有如下程序:#include<iostream>using namespace std;Class TestClass1{private:int a;public:T

若有如下程序: #include<iostream> using namespace std; Class TestClass1 { private: int a; public: TestClassl(int i) { a=i; } void disp() { cout<<a<<“,”; } }; Class TestClass2 { private: int b; public

A.10,10,10

B.10,12,14

C.8,10,12

D.8,12,10

点击查看答案
第6题
若有如下程序段:#include<iostream>using namespace std;int main (){char*p="abcdefgh",*r;r=p;

若有如下程序段: #include<iostream> using namespace std; int main () { char*p="abcdefgh",*r; r=p; cout<<*r<<end1; return 0; } 该程序的输出结果是()。

A.a

B.b

C.c

D.d

点击查看答案
第7题
若有如下程序:#include <iostream>using namespace std;int main(){ char *p="abcdefgh",*r; lon

若有如下程序: #include <iostream> using namespace std; int main() { char *p="abcdefgh",*r; long *q; q=(long *)p; q++; r=(char *)q; cout<<r<<end1; return 0; } 上述程序的输出结果是()。

A.abcdefgh

B.0

C.abcd

D.efgh

点击查看答案
第8题
若有如下程序: #include<iostream> using namespaee std; int fun() { static int i=0; int s=1;

若有如下程序: #include<iostream> using namespaee std; int fun() { static int i=0; int s=1; s+=i; i++; return s; } int main() { int i,a=0; for(i=0;i<5;i++) a+=fun(); cout<<a<<end1; return 0; } 程序运行后,输出的结果是()。

A.20

B.24

C.25

D.15

点击查看答案
第9题
若有如下程序:#include"stdio.h"voidmain(){FILE *fp;fp=fopen("test","wb")fprintf(fp,"%d%.1f,

若有如下程序: #include"stdio.h" void main() {FILE *fp; fp=fopen("test","wb") fprintf(fp,"%d%.1f,%c%c",5,238.41,'B','h'); fclose(fp); } 则程序运行后向文件输出的结果是()

A.5 238.41 B h

B.5238.4,Bh

C.5,238.4,B,h

D.5238.41Bh

点击查看答案
第10题
若有如下程序:#include<iostream>using namespace std;int s=O;class sample{static int n;publi

若有如下程序: #include<iostream> using namespace std; int s=O; class sample { static int n; public: sample(int i) { n=i; } static void add() { s+=n; } }; int sample::s=0; int main() { sample a(2),b(5); sample::add(); cout<<S<<end1; return 0; } 程序运行后的输出结果是

A.2

B.5

C.7

D.3

点击查看答案
账号:
你好,尊敬的用户
复制账号
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改
欢迎分享答案

为鼓励登录用户提交答案,简答题每个月将会抽取一批参与作答的用户给予奖励,具体奖励活动请关注官方微信公众号:简答题

简答题官方微信公众号

警告:系统检测到您的账号存在安全风险

为了保护您的账号安全,请在“简答题”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!

微信搜一搜
简答题
点击打开微信
警告:系统检测到您的账号存在安全风险
抱歉,您的账号因涉嫌违反简答题购买须知被冻结。您可在“简答题”微信公众号中的“官网服务”-“账号解封申请”申请解封,或联系客服
微信搜一搜
简答题
点击打开微信