A complex number has two parts: a real part and an imaginary part. These numbers are
written A + Bi where i = √(-1). For example 3+4i and 1-2i are complex numbers.
Write a class declaration (without defining the member functions) that enables
multiplication, addition, subtraction, input and output of complex numbers using regular
arithmetic operators as follows:
int main()
{
Complex a(3, 4);
Complex b(1, -2);
Complex c;
c = a + b;
cout << "a + b = " << c << endl;
c = a - b;
cout << "a - b = " << c << endl;
c = a * b;
cout << "a * b = " << c << endl;
return 0;
}
I'm pretty lost on where to start with this. I understand how classes work but I've never worked with complex numbers in c++ and I'm kind of confused on how to go about this.
Forget the "complex numbers". You don't need to know their math here.
All you need to do is to define a class that has some overloaded operators.
You have just had classes on your course, haven't you?
You have just had class members on your course, haven't you?
You have just had operators on your course, haven't you?