Hello,
I am writing a section of c++. Here is the section that does not work:
int a, escape;
double temp1,temp2;
escape = 0;
a = 0;
while(escape < 2){
Complex c[a];
cout << "Please input a complex number, the real part follwed by the imaginary part.\n";
if(!(cin >> temp1 >> temp2)){
return -1;
}
cout << "a is: " << a << "\n";
cout << "Setting temp1 to: " << temp1 << "\t Setting temp2 to: "<<
temp2 << "\n";
c[a].setComplex (temp1, temp2);
escape++;
a++;
}
I know a, escape, temp1, temp2 is behaving correctly. However, the assignment of c[a].setComplex is not working correctly. (setComplex works, and the classes work). After the while-loop, i've print the values of c[0] , c[1], and they are nothing like the values they should be.
I'm assuming that i'm using c[a] incorrectly, any ideas ? :) cheers
sorry, if this post isn't clear enough.