单项选择题

下面程序的运行结果是( )。
#include<iostream.h>
class Sampleint x, y;
public:
Sample() x=y=0;
Sample(int a, int b) x=a; y=b;
void (lisp()cout<<"x="<<x<<",y="<<y<<end1;;
void main()Sample s(2,3), *p=&s;
p->disp();

A.x=1, y=2
B.x=2, y=4
C.x=2, y=3
D.x=4, y=3
<上一题 目录 下一题>
热门 试题

单项选择题
有如下程序:#include <iostream>using namespace std;class BASEpublic: ~BASE()cout<< BASE ;;class DERIVED: public BASEpublic: ~DERIVED() cout<< DERIVED ; int main() DERIVED x; return 0; 执行后的输出结果是( )。
A.BASE
B.DERIVED
C.BASEDERIVED
D.DERIVEDBASE
单项选择题
下面程序的输出结果是( )。#include <iostream>using namespace std;void main()int s;for(int k=2;k<6;k+=2)s=1;for(int j=k; j<6;j++) s+=j;cout<<s<<end1;
A.9
B.1
C.11
D.10
相关试题
  • 下列程序的输出结果是 【15】 。#incl...
  • 在下面横线上填上适当的语句,完成程序。#...
  • 有如下程序:#include<iostream.h>void...
  • 下面程序的运行结果是 【13】 。#incl...
  • 已知数组a中的元素个数为n,下列语句的作用...