单项选择题
以下程序的执行结果为( )。 #include<iostream.h> Class sample { int n; public: sample(int i){n=i; } operator ++() { n++; } void display() {cout<<n<<end1; } }; void main() { sample obj(5); obj++; obj.display(); }
A.5
B.6
C.7
D.8
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
单项选择题
有以下程序: #include <iostream> using namespace std; int main() { int x; for(int i=1;i<=100;i++) { x=i; if (++x%2==0) if (++x%3==0) if (++x%7==0) cout<<x<< , ; } cout<<end1; return 0; } 执行后输出结果是( )。
A.39,81
B.42,84
C.26,68
D.28,70
点击查看答案&解析
单项选择题
有以下程序: #include <iostream> #include <string> using namespace std; class base { private: char baseName[10]; public: base ( ) { strcpy (baseName, Base ); } virtual char *myName() { return baseName; } char *className() { return baseName; } }; class Derived : public base { private: char derivedName[10]; public: Derived() { strcpy(derivedName, Derived ); } char *myName() { return derivedName; } char *className() { return derivedName; } }; void showPtr(base &p) { cout<<p.myName()<< <<p.className() ; } int main () { base bb; Derived dd; showPtr(dd) ; return 0; }
A.DerivedBase
B.BaseBase
C.DerivedDerived
D.BaseDerived
点击查看答案&解析
相关试题
下列不属于软件工程过程的基本活动的是( )。
考虑一年四季的顺序关系时,下列数据元素前...
考虑下面的函数原型: void f(int a,i...
有如下类的定义。那么空格处的语句是( )...
以下各特点中,属于算法的基本特征的是( )。