题目内容 (请给出正确答案)
[单选题]

程序运行结果是 class Sample { static int i; public: void set(int x){i=x;} Sample(int i){this->i+=i;} static disp(){cout<< i;} }; int Sample::i=50; void main() { Sample s(10); Sample::disp(); }

A.10

B.50

C.60

D.110

提问人:网友ensonli 发布时间:2022-01-06
参考答案
查看官方参考答案
如搜索结果不匹配,请 联系老师 获取答案
网友答案
查看全部
  • · 有6位网友选择 C,占比60%
  • · 有2位网友选择 A,占比20%
  • · 有1位网友选择 D,占比10%
  • · 有1位网友选择 B,占比10%
匿名网友 选择了D
[106.***.***.40] 1天前
匿名网友 选择了C
[10.***.***.23] 1天前
匿名网友 选择了C
[10.***.***.23] 1天前
匿名网友 选择了A
[4.***.***.206] 1天前
匿名网友 选择了C
[123.***.***.45] 1天前
匿名网友 选择了C
[43.***.***.232] 1天前
匿名网友 选择了C
[144.***.***.24] 1天前
匿名网友 选择了C
[63.***.***.37] 1天前
匿名网友 选择了B
[222.***.***.122] 1天前
匿名网友 选择了A
[100.***.***.52] 1天前
匿名网友 选择了C
[148.***.***.219] 1天前
匿名网友 选择了D
[106.***.***.40] 1天前
匿名网友 选择了C
[10.***.***.23] 1天前
匿名网友 选择了A
[4.***.***.206] 1天前
匿名网友 选择了C
[123.***.***.45] 1天前
匿名网友 选择了C
[43.***.***.232] 1天前
匿名网友 选择了C
[144.***.***.24] 1天前
匿名网友 选择了C
[63.***.***.37] 1天前
匿名网友 选择了B
[222.***.***.122] 1天前
匿名网友 选择了A
[100.***.***.52] 1天前
加载更多
提交我的答案
登录提交答案,可赢取奖励机会。
更多“程序运行结果是 class Sample { static …”相关的问题
第1题

若有以下程序 #include <stdio.h> int a=2; int f(int m) { static int n; n=0; n++; a++; return n+m+a; } main() { int k; for (k=0; k<4; k++) printf("%d,", f(k)); } 则程序的输出结果是( )> A、4,5,6,7,

B、4,7,10,13,

C、4,6,8,10,

D、3,5,7,9,

点击查看答案
第2题
以下程序的执行后,x和y的值是 ______ 。 #include <iostream. h> class Sample { public: int x; int y; void disp() { cout<<"x="<<x<<", y="<<y<<end1; } }; void main() int Sample: :*pc; Sample s; pc=&Sample:: x; s. *pc=10; pc=&Sample: :y; s. *pc=.20; s. disp ();

A.x=10, y=20

B.x=20, y=10

C.x=10, y=10

D.x=20, y=20

点击查看答案
第3题
下面程序段中,说法正确的是( ) class location{ public : int GetX(); }; class rectangle:private location { public: int GetW(); };

A、类rectangle私有派生类 location

B、类rectangle中的public成员在类 location中是私有的类

C、location中的public成员在类 rectangle中是不可访问的

D、viod f( ) { Rectangle r; int X=r .GetX( ); } 其中int X = r .GetX( );是非法语句

点击查看答案
第4题
运行以下代码: class Test{ public static void main(String[] args){ int x=0; int y=0; for(int z=0;z<5;z++){ if((++x>2)||(++y>2)){ x++; } } System.out.println(x+” ”+y); } } 运行结果是( )。

A、5 3

B、8 2

C、8 3

D、10 5

点击查看答案
第5题
下列程序运行的结果是 _____。 public class function { public static void main(String[] args) { System.out.println(fun(3)); } static int fun(int n) { if(n>2) { return (fun(n-1)+fun(n-2)); }else { return 2; } } }
点击查看答案
第6题
下列程序的运行结果是( )。 Public class sun { Public static void main(String args[]) { int x=4,y=0; if(Math.pow(X,2)= =16) y—x ; if(Math.pow(X,2)<15) y—l/x; if(Math.pow(X,2)>15) y=(int)Math.pow(X,2)+1; system.out.println(y); } }

A.4

B.17

C.18

D.0.25

点击查看答案
第7题
已知类 Sample中的一个成员函数说明如下: void Set (Sample &a); 其中,Sample&a的含意是()。

A.指向类Sample 的指针为a

B.将a的地址值赋给变量Set

C.a是类Smple的对象引用,用来作函数Set() 形参

D.变量Sample与a按位相与作为函数Set()的参数

点击查看答案
第8题
设有下列结构定义语句: struct score{ int Chinese; int math; }scores[2]={{80,85},{89,93}},*p=scores; 则++p->math的值为 ,++(p->math)的值为
点击查看答案
第9题
以下是"public static void test(int x, int y)"的方法重载( )

A、public static void Test(int x)

B、public static void test(int x, int y,int z)

C、public static void test(int y, int x)

D、public static void test(int x, int y)

点击查看答案
第10题
纯虚函数是一种特殊的函数,它允许没有具体的实现
点击查看答案
账号:
你好,尊敬的用户
复制账号
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改
欢迎分享答案

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

简答题官方微信公众号

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

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

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