单项选择题
有以下程序: #include <iostream> using namespace std; class sample { private: int n; public: sample(){} sample(int m) { n=m; } void addvalue(int m) { sample s; s.n=n+m; *this=s; } void disp () { cout<<"n="<<n<<endl; } }; int main() { sample s(10); s.addvalue(5); s.disp(); return 0; } 程序运行后的输出结果是
A.n=10
B.n=5
C.n=15
D.n=20
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
单项选择题
要定义数组A,使得其中每个元素的数据依次为:3、9、4、8、0、0、0,错误的定义语句是
A.intA[]={3,9,4,8,0,0,0};
B.intA[9]={3,9,4,8,0,0,0};
C.intA[]={3,9,4,8};
D.intA[7]={3,9,4,8};
点击查看答案&解析
单项选择题
对长度为n的线性表进行顺序查找,在最坏情况下所需要的比较次数为
A.log
2
n
B.n/2
C.n
D.n+1
点击查看答案&解析
相关试题
下面是复数类complex的定义,其中作为友元...
有以下程序:#include <iostream>using...
有以下程序#include <iostream>using ...
有以下程序#include <iostream>using ...
下列程序的输出结果是______。#incl...