填空题 在下面程序横线处填上适当内容,以使该程序执行结果为:
The pair is(21,55)
The pair is(21.7,85.4)
#include <iostream>
using namespace std;
template<class T>
class pair {
public:
T x,y;
void show(){
cout<<"The pair is("<<x <<","<< y<<")"<<endl;
}
};
int main() {
1;
c1. show();
2
c2. show();
return 0;
}
【正确答案】
【答案解析】pair<int> c1; c1. x= 21; c1.y=25
pair<double> c2; c2.x=21.7; c2.y= 5.4