填空题
下列程序将x、y和z按从小到大的顺序排列,请将下面的函数模板补充完整。
template<class T>
void order( )
T al
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。
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
填空题
下列程序完成从文件读取文件显示的同时写入第二个文件,则在程序中划线部分应该出现的语句是______。 #include<iostream.h> #include(fstream.h) void main() fstream filel,file2; charfnl[10],fn2[10],ch; cout<<“输入源文件名”; cin>>fnl; cout<<“输入目标文件名”; cin>>fn2; filel.open(fnl,ios::in); while((ch;filel.get())!=EOF) cout<<ch; file2.put(ch); filel.close(); file2.close();
点击查看答案&解析
填空题
在下面横线上填上适当的语句,完成程序。 #include<iostream> using namespace std; class Base int x; public: Base(int i)x=i; ~Base() ); class Derived:public Base public: ______ 完成类Derive构造函数的定义 ; iht main() Derived obj; return 0; 在横线处应填入的语句是______。
点击查看答案&解析
相关试题
operator是运算符重载时必须使用的关键字,...