#include <iostream>
using namespace std;
template <class C1, class C2>
class Complex
{
private:
C1 real;
C2 imag;
public:
Complex()
{
real=imag=0;
}
Complex(C1 x, C2 y)
{
real=x;
imag=y;
}
void Display()
{
cout<<endl<<"The complex number is "<<real<<"+j"<<imag;
}
};
int main()
{
Complex <int,int> first(3,4);
Complex <float,float> second(2.3,6.77);
first.Display();
second.Display();
return 0;
}
using namespace std;
template <class C1, class C2>
class Complex
{
private:
C1 real;
C2 imag;
public:
Complex()
{
real=imag=0;
}
Complex(C1 x, C2 y)
{
real=x;
imag=y;
}
void Display()
{
cout<<endl<<"The complex number is "<<real<<"+j"<<imag;
}
};
int main()
{
Complex <int,int> first(3,4);
Complex <float,float> second(2.3,6.77);
first.Display();
second.Display();
return 0;
}
No comments:
Post a Comment