I tried so many times to find out what is going on with my code I found the problems in cin in main function.
and I found the others two in operator >> for overloading. Can you please help me for this issue it takes a long time from me. I would highly appreciate it.
#include <iostream>
#include "complex.h"
//#include "definition.cpp"
usingnamespace std;
int main()
{
complex A;
complex B(1,2);
complex C(1,2);
cout << "\n\nA : ";
A.printcomplex();
cout << "\n\nB : ";
B.printcomplex();
cout << "\n\nC : ";
C.printcomplex();
A = B+C;
cout << "\n\nA = B + C \n ";
A.printcomplex();
cout <<" = ";
B.printcomplex();
cout << " +";
C.printcomplex();
cout << " \n\n Enter the realPart and imaginaryPart for the complex number \n\n";
cin >> A;
cout << "\n The complex number is : ";
cout << A;
A = B * C;
cout << "\n\nA = B * C \n ";
A.printcomplex();
cout <<" = ";
B.printcomplex();
cout << " *";
C.printcomplex();
if(B ==C)
cout << "\n B and C are equal";
else
cout << "\n B and C are not equal";
if(B != A)
cout << "\n B and A are not equal";
else
cout << "\n B and A are equal";
return 0;
}
This is cpp file. This file the error in this statement Enter >> num2.realPart >> num2.imaginaryPart; which say that realpart is not accessible because it is private