下列程序的输出结果是______。#includeusing namespace std;templateT fun(T a,T b) { return(a<=b)?a:b; }int main(){ cout<
查看答案
写出下列程序的执行结果是:__________________。#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<