I'm in an introduction to C++ programming class. I am suppose to create a program that loops the whole program if a character y is inputted at the end of the program. I cannot seem to get the loop to loop even when I input the value for y I have defined the variables as follows:
char value, y;
float percent;
value=y;
y=value;
while (value==y)
It checks the condition the condition and runs the program the first time, however it does not loop. The ending statement looks as follows:
"cin<< value;"
The brackets check out, too.
Is there a rule I'm missing about having multiple while loops within while loops (I have two other loops that work fine inside the bigger loop), or is it because I cannot have the "while (input==y)" as a condition?
Thank you very much
value,y, andpercentare all uninitialized and using them before you set a value is undefinded behavior. Then you show"cin << value;", which is a string, not a line of code. Please show a minimal, complete example code that reproduces the problem you are having.