Code:
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <cmath>
using namespace std;
void input_rect(double,double);
double const pi = atan(1.0);
int main()
{
int choice;
double ReA, ImA;
do
{
cout << "Complex number A: Real: " << ReA << " Imaginary: " << ImA << endl << endl;
cout << "1. Enter Complex Number A in Rectangular Form \n";
cout << "2. Enter Complex Number A in Polar Form \n";
cout << "3. Enter Complex Number B in Rectangular Form \n";
cout << "4. Enter Complex Number B in Polar Form \n";
cout << "5. Add the two Complex Numbers: C = A + B \n";
cout << "6. Find the Complex Conjugate: C = A* \n";
cout << "7. Multiply the two Complex Numbers: C = AB \n";
cout << "8. Divide the two Complex Numbers: C = A / B \n";
cout << "9. Quit \n \n";
cout << "make a selection: ";
cin >> choice;
switch (choice)
{
case 1: cout << "chose 1 \n \n";
{
input_rect(ReA,ImA);
break;
}
case 2: cout << "chose 2 \n" << endl; break;
case 3: cout << "chose 3 \n" << endl; break;
case 4: cout << "chose 4 \n" << endl; break;
case 5: cout << "chose 5 \n" << endl; break;
case 6: cout << "chose 6 \n" << endl; break;
case 7: cout << "chose 7 \n" << endl; break;
case 8: cout << "chose 8 \n" << endl; break;
}
}
while (choice !=9);
system ("pause");
return 0;
}
void input_rect(double Real, double Imag)
{
cout << "Enter real part: ";
cin >> Real;
cout << "Enter Imaginary part: ";
cin >> Imag;
cout << endl;
}