填空题
下列程序编译错误,因为add函数返回值是一个引用,故对return后返回值的要求是
【10】
。
#include<iostream. h>
int& add(int x, int y)
return x+y;
void main( )
int i=3,j=19;
cout<<(add(i,j)+ =20)<<end1;
【参考答案】
不能是表达式
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
填空题
在下面的类定义中,this指针的用途是 【11】 。 #include <iostream. h> class Sample int x,y; public: Sample(int i,int j)x=i;y=j; void asstgn(Sample sa): ; void Sample: :assign(Sample p) if (this! =&p) x=p.x; y=p.y;
点击查看答案&解析
填空题
根据三角形的基本定理完成填空,则表达式为 【8】 。 #include<iostream. h> #include<math. h> void main() double a,b,c,s,area; cout<< 请输入三角形三边a,b,c: <<end1; cin>>a>b>>c; if(______) s=(a+b+c) 2; area=sqrt(s*(s-a)*(s-b)* (s-c)), cout<< 三角形的面积为: <<area; else cout<< 不能构成三角形! <<end1;
点击查看答案&解析
相关试题
参照函数模板的写法,完成非模板函数的定义...
下列程序中的this指针的作用是 【13】 ...
下列程序的运行结果为 【14】 。 #in...
下列程序的运行结果是 【15】 。 #in...