单项选择题
下列程序的运行结果是( )。 # include <iostream.h> class A { int a; public: A( ) {a=0;} A(int aa) { a=aa; cout << a++; } }; void main( ) { A x,y (2),z(3); cout << endl; }
A.0
B.23
C.34
D.25
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
单项选择题
下列程序的运行结果为( )。# include < iostream.h >voidprint (double a){cout << ++a;}void print (int a,int b){cout << b << a;}void main( ) {print (1.2);cout << ;print (3,4);}
A.1.2 34
B.2.2 34
C.1.2 43
D.2.2 43
点击查看答案&解析
单项选择题
有以下程序#include<iostream>using namespace std;class MyClass{public:MyClass(intn) {number=n;} 拷贝构造函数MyClass (MyClass& other) {number=other.number;}~MyClass(){}private:int number;};MyClass fun (MyClass p){MyClass temp(p);return temp;}intmain(){MyClass obj1(10),obj2(0);MyClass obj3(obj1);obj2=fun(obj3);return0;}程序执行时,MyClass类的拷贝构造函数被调用的次数是【 】
A.5
B.4
C.3
D.2
点击查看答案&解析
相关试题
有以下程序:float f1(float n) { ...
有如下程序#includeusing namespace std...
有以下程序#include<iostream>using na...
下面程序的结果为( )。#include iostr...