Long story short, The code originally compiled without the ostream and istream. I don't understand how those two work all that well, and operators aren't my thing either.
It throws out 36 errors in between the ostream and istream.
The code is supposed to be able to read imaginary and real numbers, any tips, advice or anything to thrust me into the right direction would be greatly appreciated! Thanks CPP Forum ^^!
The main used to be a print function, but our professor said to remove that part for the ostream and istream, and to be frank I barely have an idea to do it.
istream & operator >> (istream &input, const Complex &temp){
when reading input, the value of temp will be modified. const is not needed here as it will prevent such changes.
ne555 It gives 30 now after tinkering with it a bit. The errors are:
Error 3 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
Error 8 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
Error 13 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
Error 18 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
Error 25 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
Error 23 error C2872: 'ostream' : ambiguous symbol
Error 10 error C2805: binary 'operator >>' has too few parameters
Error 20 error C2805: binary 'operator >>' has too few parameters
Error 5 error C2805: binary 'operator <<' has too few parameters
Error 15 error C2805: binary 'operator <<' has too few parameters
Error 22 error C2511: 'bool Complex::operator ==(const Complex &) const' : overloaded member function not found in 'Complex'
Error 21 error C2511: 'bool Complex::operator !=(const Complex &) const' : overloaded member function not found in 'Complex'
Error 2 error C2433: 'ostream' : 'friend' not permitted on data declarations
Error 12 error C2433: 'ostream' : 'friend' not permitted on data declarations
Error 7 error C2433: 'istream' : 'friend' not permitted on data declarations
Error 17 error C2433: 'istream' : 'friend' not permitted on data declarations
Error 29 error C2275: 'Complex' : illegal use of this type as an expression
Error 1 error C2143: syntax error : missing ';' before '&'
Error 6 error C2143: syntax error : missing ';' before '&'
Error 11 error C2143: syntax error : missing ';' before '&'
Error 16 error C2143: syntax error : missing ';' before '&'
Error 24 error C2143: syntax error : missing ';' before '&'
Error 26 error C2086: 'int ostream' : redefinition
Error 28 error C2065: 'temp' : undeclared identifier
Error 27 error C2065: 'output' : undeclared identifier
Error 4 error C2061: syntax error : identifier 'ostream'
Error 14 error C2061: syntax error : identifier 'ostream'
Error 9 error C2061: syntax error : identifier 'istream'
Error 19 error C2061: syntax error : identifier 'istream'
Error 30 error C1903: unable to recover from previous error(s); stopping compilation
For the most part I fixed what tipaye said about the input (Oops). and changed the const in the istream and ostream operators.
In a few of the errors it said that they needed more parameters, should I just add in new objects or is it something else?
Thanks in advance!