填空题
下列程序的运行结果是
[12]
。
include <iostream. h>
class Sample
int x,y;
public:
Sample() x=y=0;
Sample(int a, int b) x=a;y=b;
void disp()
cout<<" x=" <<x<<" , y="<<y<<end1;
;
void main()
Sample s1, s2(1, 2);
s1. disp0;
s2. disp ();
【参考答案】
此程序的运行结果为:
x=0, y=0
x=A, y=B
点击查看答案
<上一题
目录
下一题>
热门
试题
填空题
以下程序的输出结果是 [11] 。 #include<iostream. h> void main() int a[]= 1, 3, 5, 7, *p=a, i; for (i=0; i<4: i++) a[i]=*p++; cout<<a[2];
点击查看答案
填空题
以下程序的输出结果是 [10] 。 #include<iostream. h> void main() int *p; p=new int; *p=200; cout<<*p; delete p;
点击查看答案
相关试题
类的成员函数中,只能用于检测输入操作的函...
对于派生类的构造函数,在定义对象时构造函...
指出下面程序段中的错误,并说明出错原因 ...