This repository was archived by the owner on Jan 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestComplex.cpp
More file actions
81 lines (59 loc) · 2.03 KB
/
Copy pathtestComplex.cpp
File metadata and controls
81 lines (59 loc) · 2.03 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*----------------------------------------------------------------------------+
| Name: Jerome Richards |
| Course: CNS-1250 Section F01 |
| Instructor: Dr. Afsaneh Minaie |
| Program: Project Six |
| File: testComplex.cpp |
+----------------------------------------------------------------------------*/
#include <iostream>
#include "complexNumber.h"
using namespace std;
void dispPrologue();
int main()
{
double real;
double imag;
dispPrologue();
// Get the first complex number
cout << "\nPlease enter in the real part of the first complex number: ";
cin >> real;
cout << "\nPlease enter in the imaginary part of the first complex number: ";
cin >> imag;
ComplexNumber cn1( real, imag );
// Get the second complex number
cout << "\n\nPlease enter in the real part of the second complex number: ";
cin >> real;
cout << "\nPlease enter in the imaginary part of the second complex number: ";
cin >> imag;
ComplexNumber cn2( real, imag );
// Get the sum of the two complex numbers
ComplexNumber cnSum;
cnSum = cn1.Add( cn2 );
cout << "\n\nThe sum of these complex numbers = ";
cnSum.Print();
// Get the difference of the two complex numbers
ComplexNumber cnDiff;
cnDiff = cn1.Sub( cn2 );
cout << "\n\nThe difference between these complex numbers = ";
cnDiff.Print();
cin.ignore( 80, '\n' );
cin.get();
return 0;
}
/**
* Purpose: Display file prologue
*
* Parameters: none
* Pre-conditions: none
* Post-conditions: none
*/
void dispPrologue()
{
system( "cls" );
cout << " Name: Jerome Richards\n";
cout << " Course: CNS-1250 Section F01\n";
cout << "Instructor: Dr. Afsaneh Minaie\n";
cout << " Program: Project Six\n";
cout << " File: testComplex.cpp\n";
cout << "\n\n";
}