A.AB C D E F G H I J
B.AB C D * * * * * *
C.AB C D E F * * * *
D.* * * * * * A B C D
[单选题]有以下程序: #include 〈iostream〉 using namespace std; class A { public: virtual void setx(int i,int j=0) { x=i; y=j; } virtual void print()=0; protected: int x,y; }; class B : public A { public: void print() { cout〈〈x*x〈〈", "; } }; class C : public A { p
[单选题]若有以下程序: #include〈iostream〉 using namespace std; int main() { int data[4],i,j,temp; for (i=O; i<4; i++) cin>>data[i]; for (i=1; i<4; i++) { j = i-1; temp = data[i]; while (data [j ] >temp&&j >=0) { data[j+1] = data[j]; j--; }
[单选题]有如下程序: #include(iostream) using namespace std; class TestClass{ protected: TestClass(){couti(cout<<‘x’;} TestClass(char c){cout<<c;}}; class TestClassl:publicTestClass{ public: TestClassl(char c){cout<<c;}}; int main(){ TeA.yB.yxC.xyD.yy
[单选题]有如下程序: #include<iostream) using namespace std; classBase{ public: Base(int x=0){cout<<x;} }; Class Derived:public Base{ public: Derived(int x=0){cout<<x;} private: Base Val; }; int main(){ Derived d(1); returnA.100B.000C.010D.001
[单选题]有如下程序: #include(iostream> using namespace std; Class Test { public: Test() {n+=2;} ~Test() {n-=3;) static int getNum() {return n;} private: static int n; }; int Test::n=1; int main() { Test*p=new Test;A.n=0B.n=1C.n=2D.n=3
[单选题]有如下程序: #include<iostream) using namespace std; classBASE{ public: ~BASE(){cout<<“BASE”;} }; class DERIVED:public BASE{ public: ~DERIVED(){COUt<<“DERIVED”;} }; int main(){DERIVED x;return 0;} 执行后的输出结果是( )。A.BASEB.DERIVEDC.BASEDERIVEDD.DERIVEDBASE
[单选题]有如下程序: #include<iostream) using namespace std; class AA{ int n; public: AA(int k):n(k){} int get(){return n;} int get()const{return n+1;} }; int main() { AA a(5); const AA b(6); COUt<<A.get()<<b.get(); return 0A.55B.57C.75D.77
[单选题]有如下程序: #include<iostream) using namespace std; int main() { int*p; *p=9; cout<<“The value at p:”<<*p; return 0; } 编译运行程序将出现的情况是( )。A.编译时出现语法错误,不能生成可执行文件B.运行时一定输出:The value at p:9C.运行时一定输出:The value at p:*9D.运行时有可能出错
[单选题]有以下程序:include include using namespace std;int main ( ){ ofstream有以下程序: #include <iostream> #include <fstream> using namespace std; int main ( ) { ofstream ofile; char ch; ofile.open ("abc.txt"); cin>>ch; while (ch!='#' ) { cin>>ch; ofile.put(ch);
[单选题]有以下程序:include include using namespace std;class base{private: cha有以下程序: #include <iostream> #include <string> using namespace std; class base { private: char baseName[10]; public: base ( ) { strcpy (baseName, "Base"); } virtual char *myName() {A.De