Answer Values not passing properly, help!

Hello all, I'm working on a calculator program for complex numbers, and all my functions are working properly with the exception of my swap function.

The idea is too swap the value of the "answer" with the value of "A" but for some reason my "ans1,ans2,ans3, ans4" variables keep defaulting to zero resulting in the swap values being wrong despite having values obtained. Here's a snippet of the code showing the working division function and the broken swap function, any help would be appreciated.

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
          ComplexNumber divi (const ComplexNumber& c) //division function
			{
				ComplexNumber comp;
				comp.ans1= this->realA/c.realB;
				comp.ans2= this->imagA /c.imagB;
				comp.ans3= this->magnitudeA/c.magnitudeB;
				comp.ans4= this->angleA /c.angleB;
				return comp;
			}
			
			ComplexNumber ANS2A (const ComplexNumber& c)	//Answer swapto A function
			
			{
			
					
			ComplexNumber comp;
			
			comp.realA = this->realA + c.ans1;
			comp.ans1 = this->realA - c.ans1;
			comp.realA = this->realA-c.ans1;
			
			comp.imagA = this->imagA + c.ans2;
			comp.ans2 = this->imagA - c.ans2;
			comp.imagA = this->imagA-c.ans2;
			
			comp.magnitudeA = this->magnitudeA + c.ans3;
			comp.ans3 = this->magnitudeA - c.ans3;
			comp.magnitudeA = this->magnitudeA - c.ans3;
			
			comp.angleA = this->angleA + c.ans4;
			comp.ans4 = this->angleA - c.ans4;
			comp.angleA = this->angleA - c.ans4;
			
			return comp;
			
Topic archived. No new replies allowed.