以下程序的执行结果为( )。
#include <iostream.h>
class Sample

int n;
public:
Sample(int i) n=i;
operator++( ) n++; //前缀重载运算符
operator++(int) n+=2; //后缀重载运算符
void disp( )

cout<<"n="<<n<<endl;

;
void main( )

Sample A(2),B(2);
A++;
++B;

题库:计算机等级考试 类型:最佳选择题 时间:2017-07-03 15:45:47 免费下载:《单项选择》Word试卷

以下程序的执行结果为( )。
#include <iostream.h>
class Sample

int n;
public:
Sample(int i) n=i;
operator++( ) n++; //前缀重载运算符
operator++(int) n+=2; //后缀重载运算符
void disp( )

cout<<"n="<<n<<endl;

;
void main( )

Sample A(2),B(2);
A++;
++B;
A.disp();disp();
n=4
B.n=1
C.n=3
D.n=5
n=3 n=2 n=4 n=6

以下程序的执行结果为(  )。  #include <iostream.h>  class Sample    int n;  public:  Sample(

本题关键词:行为结果,行为结果评价,道德行为效果,竣工结算程序,执业资格行为,行政诉讼程序,结果,工程行为识别,行为过程评价,以僧为师;

微信扫码获取答案解析
下载APP查看答案解析