#includeusingnamespacestd;voidfun();intmain(){inti;for(i=0;i<5;i++)fun();}voidfun(){staticintm=0;cout<
查看答案
写程序运行结果#include class B;class A{int data;A *prev;public:A(int d,A *n){data=d;prev=n;}friend class B;};class B{A *top;public:B(){top=0;}void push(int i){A *n=new A(i,top);top=n;}int pop(){A *t=top;if(top){top=top->prev;int c=t->data;delete t;return c;}return 0;}};void main(){int c[10]={23,34,56,87,67,876,42,657,55,66};B s;for(int i=0; i<10;i++)s.push(c[i]);for(i=0; i<10; i++)cout<
写程序运行结果#include class A{friend class C;int x,y;public:A(int a,int b) { x=a; y=b; }void Add(int a,int b){ x+=a; y-=b; }void Display(){cout<
程序填空。以下程序输出结果为:s=7请把程序补充完整#includeusing namespace std;class Sample {private: int a; static int s; public: Sample(int n){a=n; s+=a;} static void func(Sample s); }; void Sample::func( ) { cout<<"s="<
已知:print()函数是一个类的常成员函数,它无返回值,下列表示中,(A)是正确的。