Overloading

I am positive I did this right but I can't figure out why when I compile I am getting a weird error.

header
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
  
#ifndef H_complexNumber
#define H_complexNumber

#include <iostream>
using namespace std;

class complexType
{
	friend ostream& operator<<(ostream&, const complexType&);
	friend istream& operator>>(istream&, const complexType&);

public:
	void setComplex(const double& real, const double& imag);
	void getComplex(double& real, double& imag) const;
	complexType(double real = 0, double imag = 0);
	complexType operator+ (const complexType& otherComplex) const;
	complexType operator* (const complexType& otherComplex) const;
	complexType operator- (const complexType& otherComplex) const;
	complexType operator/ (const complexType& otherComplex) const;
	bool operator== (const complexType& otherComplex) const;
	double realPart;
	double imaginaryPart;
	
};

#endif 


functions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include "complexNumber.h"

ostream& operator<< (ostream& osObject, const complexType& complex)
{
	osObject << "(";
	osObject << complex.realPart;
	osObject << ", ";
	osObject << complex.imaginaryPart;
	osObject << ")";

	return osObject;
}

istream& operator>> (istream& isObject, complexType& complex)
{
	char ch;

	isObject >> ch;
	isObject >> complex.realPart;
	isObject >> ch;
	isObject >> complex.imaginaryPart;
	isObject >> ch;

	return isObject;
}

bool complexType::operator==(const complexType& otherComplex) const
{
	return (realPart == otherComplex.realPart && imaginaryPart == otherComplex.imaginaryPart);
}

complexType::complexType(double real, double imag)
{
	realPart = real;
	imaginaryPart = imag;
}

void complexType::setComplex(const double& real, const double& imag)
{
	realPart = real;
	imaginaryPart = imag;
}

void complexType::getComplex(double& real, double& imag) const
{
	real = realPart;
	imag = imaginaryPart;
}

complexType complexType::operator+(const complexType& otherComplex) const
{
	complexType temp;

	temp.realPart = realPart + otherComplex.realPart;
	temp.imaginaryPart = imaginaryPart + otherComplex.imaginaryPart;

	return temp;
}

complexType complexType::operator*(const complexType& otherComplex) const
{
	complexType temp;


Program
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

#include <iostream>
#include "complexNumber.h"

using namespace std;

int main()
{
	complexType num1 (23, 34);
	complexType num2;
	complexType num3;

	cout << "Num1 = " << num1 << endl;
	cout << "Num2 = " << num2 << endl;

	cout << "Enter the complex number "
		 << "in the form of (a, b) ";
	cin >> num2;
	cout << endl;

	cout << "New value of num2 = " << num2 << endl;
	
	num3 = num1 + num2;

	cout << "Num3 = " << num3 << endl;
	
	cout << num1 << " + " << num2 << " = " << num1 + num2 << endl;
	cout << num1 << " * " << num2 << " = " << num1 * num2 << endl;
	cout << num1 << " - " << num2 << " = " << num1 - num2 << endl;
	cout << num1 << " / " << num2 << " = " << num1 / num2 << endl;
	
	return 0;
}


Any idea?
getting a weird error

And the error is...?
Registered users can post here. Sign in or register to post.