Of course, as I told you: it runs fine because while (yn = 1) assigns 1 to yn every loop cycle.Quote:
It runs just fine the way it is in my previous post, but it won't exit.
Running the program, even typying in any different number, yn will be changed to 1 again.
You can't rerun the program because you compare (yn == 1) when yn is a char.Quote:
I set yn = 1 just before the while statement and after the char yn; statement, and it doesn't allow me to rerun the program at all.
A char is interpreted as a character, not a numeric value, so the comparing won't be true when you type in 1.
Two solutions:
1: Declare yn as an int or a bool.
2: Compare yn with a char -> (yn == "r")
and of course change the sentence to "Enter 'r' to rerun program: "