Design a class template with overloaded operator / to perform a = b / c.
include <iostream>
#include <conio.h>
using namespace std;
template<class t1,class t2>
void sum(t1 a,t2 b) // defining template function
{
cout<<"Div="<<a/b<<endl;
}
int main()
{
int a,b;
float x,y;
cout<<"Enter two integer data: ";
cin>>a>>b;
cout<<"Enter two float data: ";
cin>>x>>y;
Div(a,b); // dividing two integer type data
getch();
return 0;
}
Comments
Leave a comment