填空题
下列程序编译错误,因为add函数返回值是一个引用,故对return返回值的要求是______。 #include<iostream.h> int& add(int x,int y) { return x+y; } void main( ) { int i=3,j=19; cout<<(add(i,j)+=20)<<endl; }
【参考答案】
不能是表达式
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
填空题
下列程序的输出结果是______。#include<iostream>using namespace std;template<typename T>T fun(T a,T b){return(a<=b) a:b;}int main( ){cout<<fun(3,6)<<’,’<<fun(3.14F,6.28F)<<endl;return 0;}
点击查看答案&解析
填空题
参照函数模板的写法,完成非模板函数的定义,语句为______。#include<iostream.h>#include<string.h>template<class T>T min(T a,T b){return(a<b a:b);}char*rain(char*a,char*b){______}void main( ){double a=1.23,b=3.45;char s1[]= abed ,s2[]= efg ;cout<<min(a,b)<<min(s1,s2)<<endl;}
点击查看答案&解析
相关试题
下列程序的运行结果为______。#incl...
下列程序的运行结果是______。#incl...