#include<iostream>
using namespace std;
class Name{
char name[20];
public:
Name(){
strcpy(name,""); cout<<'?';
}
Name(char *fname)){
strcpy(name,fname); cout<'?';
}
};
int main(){
Name names[3]={Name(" 张三 "),Name(" 李四 ")};
Return 0;
}
运行此程序输出符号?的个数是
A. ) 0
B. ) 1
C. ) 2
D. ) 3
[单选题]( 29 )有如下程序:#include<iostream>using namespace std;class Part{public:Part(int x=0):val(x) {cout<<val;}~Part(){cout<<val;}private:int val;};class Whole{public:Whole(int x ,int y, int z=0):p2(x),p1(y),val(z){cout<<val;}~Whole(){c
[单选题]( 32 )有如下程序;#include<iostream>using namespace std;class Base{public:void output(){cout<<1;}virtual void Print(){cout<<'B';}};class Derived:public Base{public:void output(){cout<<2;}void Print(){cout<<'D';}};int main(
[单选题]( 30 )有如下程序:#include<iostream>using namespace std;class Base{public:B.ase(int x=0){cout<<x;}};class Derived:public Base{public:D.erived(int x=0){cout<<x;}private:B.ase val;};int main(){D.erived d(1);return 0;}程序的输出结果是A. ) 0B. ) 1C.
[试题]( 10 )有如下程序:#include<iostream>using namespace std;class A{public:A.(){cout<<"A" ; }~A(){cout<<"A" ; }} ;class B {A. a;public:B.(){cout<<"B";}~B(){cout<<"B";}};int main (){B. b;return 0;}程序的输出结果是 ___________
[单选题]( 30 )有如下程序:#include<iostream>using namespace std;class AA{lilt k;protected:int n;void setK ( int k ) { this->k=k;}public:void setN ( int n ) { this->n=n;}};class BB: public }{/* 类体略 */};int main () {B.B x_ ; //1x .n=1; //2x.setN ( 2 ) ;
[单选题]( 32 )有如下程序:#include<iostream>Using namespace std;class A{public:virtual void f () {cout+1;}void g () {cout<<2;}};class B:public A{public:virtual void f () {cout<<3;}void g () {ecut<<4;}};void show ( A &a ) {a.f ( ) ; a.g
[单选题]( 35 )有如下程序:#include<iostream>using namespace std;class ONE{int c;public:ONE ( ) : c ( 0 ) {cout<<1;}ONE ( int n ) : c ( n ) {cout<<2;}};class TWO{ONE onel;ONE one2;public:TWO ( int m ) : one2 ( m ) {cout<<3;}};int main () tTW
[单选题]( 33 )有如下程序:#include<iostream>using namespace std;class Pair{int m;int n;public:Pair ( int i , int j ) : m ( i ) , n ( j ) {}boot operator > ( pair p ) const; // 须在类体外给出定义} ;int main () {Pair Al ( 3,4 ) , p2 ( 4,3 ) ; p3 ( 4,5 ) ;C.out<&l
[试题]( 11 )有如下程序:#include<iostream>using namespace std;class Monitor{public:Monitor ( char t ) : type ( t ) {}void print ( ) const{cout<<"The type of monitor is"<<type<<endl;}private:char type;};class Computer{public:C.omputer ( i
[单选题]( 30 )有如下程序:#include<iostream>using namespace std;public:A.A(){ cout<<'1'; }};class BB: public AA{int k;public:B.B():k(0){ cout<<'2'; }B.B(int n):k(n){ cout<<'3';}}int main(){B.B b(4), c;return 0;}运行时的输出结果是A. ) 1312B. )