填空题
下列程序编译错误,因为add函数返回值是一个引用,故对return返回值的要求是______。
#included<iostream.h>
int & add(int x,int y)
return x+y;
void main()
int i=3,j=19;
cout<<(add(i,j)+=20)<<endl;
【参考答案】
不能是表达式
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
填空题
下列程序的运行结果是______。 #included<iostream.h> class Sample int a; public: Sample(int aa=0)a=aa; ~Sample()cout<< Sample= <<a<<’’; ; class Derived:public Sample int b; public: Derived(int aa=0,int bb=0):Sample(aa)b=bb; ~Derived()cout<< Derived= <<b<<’’; ; void main() Derived d1(9);
点击查看答案&解析
填空题
参照函数模板的写法,完成非模板函数的定义,语句为______。 #include<iostream.h> #include<string.h> template<class T> T min(T a,T b) return(a<b a:b); char*min(char *a,char *b) void main() double a=1.23,b=3.45; char s1[]= abcd ,s2[]= efg ; eout<<min(a,b)<<min(s1,s2)<<endl;
点击查看答案&解析
相关试题
在下面的类定义中,this指针的用途是___...
以下函数模板main()的功能是:返回数组a...