[试题]

( 14 )请将如下程序补充完整,使得输出结果为: bbaa

#include<iostream>

using namespace std;

class A{

public:

___________{cout<<"aa";}

};

class B:public A{

public:

~B(){cout<<"bb";}

};

int main(){

B. *p=new B;

delete p;

return 0;

}

参考答案与解析:

相关试题

( 12 )请将下面的程序补充完整,使得程序输出 “ 飘是张娜的书 ” 。#in

[试题]( 12 )请将下面的程序补充完整,使得程序输出 “ 飘是张娜的书 ” 。#include <iostream>using namespace std;class Book{public:B.ook(char *str) {strcpy(title,str);}( 12 ) void PrintInfo() {cout<<title<<endl;}protected:char title[50];};class MyBook:public Book{public

  • 查看答案
  • ( 9 )已知如下程序的输出结果是 23 ,请将画线处缺失的部分补充完整。#in

    [试题]( 9 )已知如下程序的输出结果是 23 ,请将画线处缺失的部分补充完整。#include<iostream>using namespace std;class MyClass {public:void Print()const{cout<<23;}};int main() {MyClass*p=new MyClass();___________.Print();return 0;}

  • 查看答案
  • 若下面程序运行时输出结果为1, A, 10.12, B, 3.5请将程序补充完整

    [试题]若下面程序运行时输出结果为1, A, 10.12, B, 3.5请将程序补充完整 。#includeusing namespace std;int main(){void test(int, char,double ( 8 ) );test(1,'A',10.1);test(2,'B');return 0;}void test(int a, char b, doubleC. .{cout<}

  • 查看答案
  • ( 10 )已知下列程序的输出结果是 42 ,请将画线处缺失的部分补充完整。#i

    [试题]( 10 )已知下列程序的输出结果是 42 ,请将画线处缺失的部分补充完整。#includeusing namespace std;class Foo {int value;public:F.oo( ) : value(0) {}void setValue(int value){ ( 10 ) = value; // 给 Foo 的数据成员 value 赋值 }void print( ) { cout << value; }};int main( ){F.oo f;f.setValue

  • 查看答案
  • 请将以下程序中的函数声明语句补充完整 #include <stdio.h> in

    [主观题]请将以下程序中的函数声明语句补充完整#include <stdio.h>int(12) ;main( ){int x,y,(*p)();p=max;printf(“&d/n”,&x,&y);}Int max(int a,int b){return (a>b/a:b);}

  • 查看答案
  • 请将以下程序中的函数声明语句补充完整。#include <stdio.h>int

    [试题]请将以下程序中的函数声明语句补充完整。#include <stdio.h>int ( 1 2 ) ;main(){ int x,y,(*p)();scanf("%d%d",&x,&y);p=max;printf("%d/n",(*p)(x,y));}int max(int a,int b){ return(a>b?a:b);}

  • 查看答案
  • (14)以下程序运行后的输出结果是 (14) 。#include <stdio.

    [主观题](14)以下程序运行后的输出结果是 (14) 。#include <stdio.h>#include <stdlib.h>#include <string.h>main(){ char *p; int i;p=(char *)malloc(sizeof(char)*20);strcpy(p,"welcome");for(i=6;i>=0;i--) putchar(*(p+i));printf("/n "); free(p);}

  • 查看答案
  • 执行如下程序后的输出结果是()。include include using na

    [单选题]执行如下程序后的输出结果是()。include include using namespace std;int ma执行如下程序后的输出结果是[ ]。include <iostream>include <fstream>using namespace std;int main ( ){char s[25];ofstream fl("data.txt");f1<<"C++ Programming";f1.close ();ifstream f2 ("data.txt");

  • 查看答案
  • 以下程序的输出结果是( 14 )#include <stdio.h> #incl

    [试题]以下程序的输出结果是( 14 )#include <stdio.h>#include <stdio.h>#include <stdlib.h>#include <string.h>main( ){ char *p,*q,*r,p=q=r=(char*)malioc( sizeof(char)*20);strcpy(p,"attaboy,welcome!");printf(”%c%c%c/n”,p[ 11 ], q[ 3 ],r[ 4 ]);fre

  • 查看答案
  • 如下程序的输出结果是______。 include using namespac

    [主观题]如下程序的输出结果是______。 include using namespace std; class Pet{ char nam如下程序的输出结果是______。include<iostream>using namespace std;class Pet{char name[10];public:Pet(char*nanle){strcpy(this->name,name);}const char*getName( )const{return name;}virtual void call(

  • 查看答案
  • ( 14 )请将如下程序补充完整,使得输出结果为: bbaa#include<i