# warning c4700

• 03-06-2011
whatever125
warning c4700
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; }```
• 03-06-2011
kmdv
What's the question?

warning c4700 - Szukaj w Google

Uninitialized:

double ReA, ImA;
• 03-06-2011
whatever125
what does it mean by it's uninitialized?

When I assign it values, they stay that value when i need it to change
• 03-06-2011
kmdv
Code:

```double ReA, ImA; do {         cout << "Complex number A: Real: " << ReA << " Imaginary: " << ImA << endl << endl;```
In the above code, ReA and ImA are printed when they have no value assigned yet. Well, they WILL contain some numbers, but these numbers will be random, which is not desired. C++ does not assign any value to local variables, you have to it on your own:

Code:

`double ReA = 0, ImA = 1;`
• 03-06-2011
whatever125
I put numbers in for those value, but they stay that value, they won't change when the user inputs a new number for them in the function call
• 03-06-2011
nvoigt
Reasearch the difference between "pass-by-value" and "pass-by-reference". If you change your function from by-value to by-reference, it should work.

You may want to remove #include "stdafx.h" as you don't need it in your case. That's just unneccessary crap added by your compiler.
• 03-07-2011
iMalc
Quote:

Originally Posted by whatever125
what does it mean by it's uninitialized?

When I assign it values, they stay that value when i need it to change

With that program they'll keep the values they had regardless of whether you initialise them or not.