单项选择题

下列程序的运行结果是( )。 # 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
相关试题
  • 某二叉树中度为 2 的结点有 18 个,...
  • 以下程序的输出结果是【 】。#include<i...
  • 从实现的角度划分,C++所支持的两种多态...
  • 已知下列程序的输出结果是42,请将画线处...
  • 函数重载要求重载的函数必须有和原函数一样...