#include <iostream>
using namespace std;
template <class T>
T add(T x, T y)
{
T result;
result = x+y;
return result;
}
template <class T>
T sub(T x, T y)
{
T result;
result = x-y;
return result;
}
template <class T>
T mul(T x, T y)
{
T result;
result = x*y;
return result;
}
template <class T>
T divi(T x, T y)
{
T result;
result = x/y;
return result;
}
int main()
{
int a,b;
a=7;
b=5;
cout<<add(a,b)<<endl;
cout<<sub(a,b)<<endl;
cout<<mul(a,b)<<endl;
cout<<divi(a,b)<<endl;
system("pause");
return 0;
}
This is the output:
12
2
35
1
0 comments:
Post a Comment