问答题

给出下面程序的输出结果。
#include < iostream.h >
static int a = 3;
void fun();
void main ()
{ for(int i = 1; i <a; i ++ )
fun();
cout << endl;
}
void fun ()
{ static int a = a;
cout<<(a+ =2) <<" ";
}

【参考答案】

2 4
<上一题 目录 下一题>
热门 试题

问答题
#include < iostream.h >class AA{ public:AA(______){ A = i; B = j; cout << Constructor n ; }AA ( AA &obj){ A = obj.A;B =obj.B;cout << Copy Constructor n ;}~ AA() { cout << Destructor n ; }void show(){ cout << A = << A << , B = << B << endl; }private:int A, B;};void main(){AA a1 (2,3);AA a2(a1);a2.show();______=&a2;pa->show();}
问答题
#include < iostream.h >class Samp{ public:void Setij(int a, int b){i =a, j =b; }~ Samp(){ cout << Destroying.. << i << endl; }int GetMuti() { return i * j;}protected :int i;int j;};int main(){ Samp * p;p = new Samp ____;if( ! p){ cout << Allocation error n ;return 1;}for(int j =0; j <5; j ++ )p[j]..Setij(j, j);for(int k =0; k <5; k ++)cout << Muti[ <<k << ] is: <<p[k].______<<endl;______return 0;}
相关试题
  • 写一个程序,定义一个抽象类Shape,由它派...
  • 给出下面程序的输出结果。#include < i...