填空题

下列程序将x、y和z按从小到大的顺序排列,请将下面的函数模板补充完整。
template<class T>
void order( 【15】 )
T a;
if(x>y)
a=X;x=y;y=a;
if(y>z)
a=y;y=z;z=a;
if(x>y)
a=X;x=y;y=a;

【参考答案】

T &x,T &y,T &z
<上一题 目录 下一题>
热门 试题

填空题
表达式c3=c1.operator+(c2)或c3=operator+(c1,c2)还可以表示为 【9】 。
填空题
下面程序运行时输出结果为 【8】 。 #include<iostream.h> #include<malloc.h> class Rect public: Rect(int1,int w)(length=1;width=w;) void Print()cout<< Area: <<length *width<<endl;) void *operator new(size-t size)return malloc(size); void operator delete(void *p)free(p) private: int length,width; ; void main() Rect*p; p=new Rect(5,4); p->Print(); delete p;
相关试题
  • 有如下程序: #include<iostream> usi...
  • 下列语句段将输出字符“。”的个数为( )...
  • 设有以下定义和程序: #include<iostrea...
  • 若有以下程序: #include<iostream> u...
  • 有如下程序: #include<iostream> usi...