题目内容

写出下列程序的执行结果是:__________________。#include using namespace std;template double average( T *array,int size ){ T sum = 0; for( int i=0; i

查看答案
更多问题

写出下列程序的执行结果是:__________________。#include using namespace std;template class Base{ public: Base( T i , T j ) { x = i; y = j; } T sum() { return x + y; }private: T x , y;} ;void main(){ Base obj2(3.3,5.5); cout << obj2.sum() <<","; Base obj1(3,5); cout << obj1.sum() << endl;}

写出下列程序的执行结果是:__________________。#include using namespace std;template void fun( T &x, T &y ){ T temp; temp = x; x = y; y = temp;}void main(){ int i , j; i = 10; j = 20; fun( i, j ); cout << "i=" << i << "," << "j=" << j << ","; double a , b; a = 1.1; b = 2.2; fun( a, b ); cout << "a=" << a <<","<< "b=" << b << endl;}

在下划线处填上缺少的部分。源程序如下:#include using namespace std;template T fun(T x) { _________________ y; y=x*x-T(5); return y; } void main() { float a=2; cout<

如下函数的作用是以双倍行距输出文件:void double_space(ifstream& f, ofstream& t){ char c; while(______){ ______; if(c=='\n') t.put(c); }}下划线处应填入的内容是______。

答案查题题库