輸入
有若干組數據
每組數據三行
第一行是一個浮點數f和一個整數 n
第二行是兩個浮點數 x 和 y
第三行是兩個整數 p 和q
輸出
對每組數據
先輸出 x + y - f
再輸出 p + q - n
樣例輸入
2.2 3 1.0 2.0 10 20 4.5 30 4.8 9.2 100 200
樣例輸出
0.8 27 9.5 270
#include <iostream>
using namespace std;
template <class T>
class Add{
public:
//begin
T t;
Add(T t1)
{
t=t1;
}
T operator()(T t1,T t2)
{
t=t1+t2-t;
return t;
}
};
//end
int main(){
double f;
int n;
while( cin >> f >> n) {
Add<double> a1(f);
Add<int> a2(n);
double x,y;
int p,q;
cin >> x >> y >> p >> q;
cout << a1(x, y) << endl;
cout << a2(p, q) << endl;
}
return 0;
}