如下程序编译时发生错误,错误的原因是show函数实现语句错误,则正确的语句应该为______。include<iostream.h>class test{private:int hum;public:test(int);void show( );};test::test(int n){num=n;}test::show( ){cout<<num<<endl;}void main( ){test T(10):T.show( );}

如下程序编译时发生错误,错误的原因是show函数实现语句错误,则正确的语句应该为______。

include<iostream.h>

class test

{

private:

int hum;

public:

test(int);

void show( );

};

test::test(int n){num=n;}

test::show( ){cout<<num<<endl;}

void main( )

{

test T(10):

T.show( );

}


相关考题:

阅读以下程序#include stdio.hmain(){ int case; float printF;printf(" 请输入 2 个数 : ");scanf("%d %f",case,printF);printf("%d %f\n",case,printF);}该程序编译时产生错误,其出错原因是A) 定义语句出错, case 是关键字,不能用作用户自定义标识符B) 定义语句出错, printF 不能用作用户自定义标识符C) 定义语句无错, scanf 不能作为输入函数使用D) 定义语句无错, printf 不能输出 case 的值

下列关于语句的描述中,错误的是()。A.C++程序中的函数是由若干条语句组成的B.每条语句都要实现某种操作C.条件语句是用来实现分支操作的D.循环语句是用来在一定条件下重复执行某段程序的

现有如下程序段,此程序段编译有错误,则程序段的错误出在#includemain(){ int a=30,b=40,c=50,d;d=a 30?b:c;switch(d){case a:printf("%d,",a);case b:printf("%d,",b);case c:printf("%d,",c);default:printf("#");}}A.default:printf("#");这个语句B.d=a30?b:c;这个语句C.case a:printf("%d,",a); case b:printf("%d,",b); case c:printf("%d,",c);这三个语句D.switch(d)这个语句

下面程序错误的语句是①include ②void main( 0③{④int * p = new int[1] ;⑤p =9;⑥co 下面程序错误的语句是 ①#include < iostream.h> ②void main( 0 ③{ ④ int * p = new int[1] ; ⑤ p =9; ⑥ cout <<*p <<end1; ⑦ delete [ ] p; ⑧ }A.④B.⑤C.⑥D.⑦

下面程序错误的语句是 ① include ② void main( ) ③ { ④ int * p=new int[1] ; ⑤ p 下面程序错误的语句是① #include<iostream.h>② void main( )③ {④ int * p=new int[1] ;⑤ p=9;⑥ cout < < * p < <endl;⑦ delete[ ] p;⑧ }A.④B.⑤C.⑥D.⑦

有以下程序main( ){ char a,b,c,*d;a='\';b='\xbc';c='\0xab';d="\0127";cout<<a<<b<<c<<*d<<endl;}编译时出现错误,以下叙述中正确的是A.程序中只有a='\';语句不正确B.b='\xbc';语句不正确C.d="\0127";语句不正确D.a='\';和c='\0xab';语句都不正确

下列有关内联函数的描述中,错误的是()。 A.内联函数必须在定义处加上inline关键字,否则就是普通的函数B.内联函数必须是一个小函数,不能包含循环、switch等语句C.一个函数中如果包含循环、switch等语句,则将其定义为内联函数时编译器会报错D.在编译程序时,系统会直接将调用内联函数的地方用内联函数中的语句体做等价替换,从而省去运行程序时函数调用所额外消耗的时间

main函数中发生编译错误的语句是______。 include class A { public: int a; const i main函数中发生编译错误的语句是______。include<iostream.h>class A{public:int a;const int b;A( ):a(10),b(20){}void fun( )const{cout<<"a="<<a<<"\tb="<<b<<endl;}};void main( ){A obj1;const A*ptr=new A;ptr=obj1;ptr->a=100;ptr->fun( );}

对于已经被定义过可能抛出异常的语句,在编译时()。A.必须使用try/catch语句处理异常B.如果程序错误,则必须使用try/catch语句处理异常C.不使用try/catch语句会出现编译错误D.不使用try/catch语句不会出现编译错误

有如下程序:#includeiostreamusing namespace std;class Music{public:void setTitle(char*str){strcpy(title,str);}protected:char type[10];private:char title[20];};class Jazz:public Music{public:void set(char*str){strcpy(type,”Jazz”); //①strcpy(title,str); //②}};下列叙述中正确的是A.程序编译正确B.程序编译时语句①出错C.程序编译时语句②出错D.程序编译时语句①和②都出错

有如下程序:#includeiostreamusing namespace std;class Instrument{public:virtual void Display()=0;};class Piano:public Instrument {public:void Display(){/*函数体程序略*/}};int main(){Instrument s;Instrument *p=0;//…;return 0;}下列叙述中正确的是A.语句“Instrument *p=0;”编译时出错B.语句“Instrument s;”编译时出错C.类Piano中的Display函数不是虚函数D.类Instrument是一个虚基类

阅读以下程序:该程序在编译时产生错误,原因是( )。A.定义语句出错,Case是关键字,不能用作用户自定义标识符B.定义语句出错,printF不能用作用户自定义标识符C.定义语句无错,sCanf不能作为输入函数使用D.定义语句无错,printf不能输出Case的值

下面程序有注释的语句中,错误的语句是( )。 include using namespace std; 下面程序有注释的语句中,错误的语句是( )。 #include <iostream> using namespace std; class A{ int a; public: void show A(){cout<<"this is A!";} }; class B:public A{ int b; public: void show B(){cout<< "this is B!";} }; void main(){ A ia,*piA; B ib,*piB; piA=ia; //第一个测试语句 piA=ib; //第二个测试语句 piA->showA(); //第三个测试语句 piA->showB(); //第四个测试语句 }A.第一个测试语句B.第二个测试语句C.第三个测试语句D.第四个测试语句

下列程序编译时发现pb->f(10);语句出现错误,其原因是______。 include class Base { 下列程序编译时发现pb->f(10);语句出现错误,其原因是______。include<iostream.h>class Base{public:void f(int x){cout<<"Base:"<<x<<endl;)};class Derived:public Base{public:void f(char*str){cout<<"Derived:"<<str<<endl;}};void main(void){Derived*pd=new Derived;Pd->f(10);}

下面的程序在编泽时产生错误,其出错原因是()。includemain(){int 1_case;float printF; 下面的程序在编泽时产生错误,其出错原因是( )。 #include<stdio.h> main() {int 1_case;float printF; printf("请输入2个数:"); scanf ("%d%f",1_case,printF); printf("%d%f\n",1_case,printF); }A.定义语句出错,1_case不能作为变量名B.定义语句出错,printF不能用作用户自定义标识符C.定义语句无错,scanf不能作为输入函数使用D.定义语句无错,printf不能输出1_case的值

有如下程序:Private type stuX as stringY as integerEnd typePrivate Sub Command1_Click()Dim a as stua.x=”ABCD”a.Y=12345print aEnd Sub程序运行时出现错误,错误的原因是A)Type定义语句没有放在标准模块中B)变量声明语句有错C)赋值语句不对D)输出语句print不对

假定已有如下变量说明和枚举定义:判断下列语句是否符合语法规则,结果是()。 A.语句1错误,语句2和语句3正确B.语句2正确,语句1和语句3错误C.语句3正确,语句1和语句2错误D.语句1正确,语句2和语句3错误

现有如下程序段,此程序段编译有错误,则程序段的错误出在includemain(){int a=30,b=40, 现有如下程序段,此程序段编译有错误,则程序段的错误出在 #include<stdio.h> main() { int a=30,b=40,c=50,d; d=a>30? b:c; swish(d) { case a: Printf("%d,",a); case b: printf("%d,",b); case c: printf("%d,",c); default printf("#");}}A.default:printf("#");这个语句B.d=a>30? b:c;这个语句C.case a:printf("%d,",a);case b:printf("%d,",b);case c:printf("%d,",c);这三个语句D.switch(d)这个语句

以下函数findmin拟实现在数组中查找最小值并作为函数值返回,但程序中有错导致不能实现预定功能。造成错误的原因是( )。A)定义语句int i,min;中vain未赋初值B)赋值语句min=MAN;中,不应给min赋MAX值C)语句if(minD)赋值语句min=MAX;放错了位置

有如下程序: Private Type stu X As String Y As Integer End Type Private Sub Command1 Click( ) Dim a As stu X="ABCD" Y=12345 Print a End Sub 程序运行时出现错误,错误的原因是( )。A.Type定义语句没有放在标准模块中B.变量声明语句有错C.赋值语句不对D.输出语句Print不对

有如下程序:includeusing namespace std;class MyClass{public:MyClass(int x):val( 有如下程序: #include<iostreanl> using namespace std; class MyClass{ public: MyClass(int x):val(x){ } void Set(int x){val=x;} void Print( )eonst{eout<<"val="<<val<<'\t';} private: int val; }; int main( ){ eonst MyClass objl(10); MyClass obj2(20); objl.Print(); //语句1 obj2.Print( ); //语句2 objl.Set(20); //语句3 obj2.Set(30); //语句4 return 0; } 其主函数中错误的语句是A.语句1B.语句2C.语句3D.语句4

下面程序错误的语句是①include ②void main()③{④int * p=new int[1]⑤p=9⑥cout 下面程序错误的语句是①#include<iostream.h>②void main()③{④ int * p=new int[1]⑤ p=9⑥ cout<<* p<<end1;⑦ delete []p;⑧}A.④B.⑤C.⑥D.⑦

请在如下程序中的空格处填写正确的语句: include using namespace std; class Base { 请在如下程序中的空格处填写正确的语句:include <iostream>using namespace std;class Base {public:void fun() {cout<<"Base fun"<<endl; }};class Derived: public Base {public:void fun() {【 】; //调用基类的函数fun()cout<<"Derived fun "<<endl;}};

下面关于文件包含语句说法错误的是()。A、在包含文件时,如果没有找到文件,include语句会发生警告信息,程序继续运行。B、在包含文件时,如果没有找到文件,require语句会发生致命错误,程序停止运行。C、“./”表示当前目录,“../”表示当前目录的上级目录。D、在包含文件时,被包含的文件路径必须是从盘符开始的路径。

编译语句int aInt=66666不会出现编译错误。

单选题下面关于文件包含语句说法错误的是()。A在包含文件时,如果没有找到文件,include语句会发生警告信息,程序继续运行。B在包含文件时,如果没有找到文件,require语句会发生致命错误,程序停止运行。C“./”表示当前目录,“../”表示当前目录的上级目录。D在包含文件时,被包含的文件路径必须是从盘符开始的路径。

单选题有如下程序段:其中会产生编译错误的语句是(  )。A④B③C②D①