Hello tiger0998,
After thinking on your questions this is what I see:
Starting at line 12 you want to know how to check if "R" has been pressed. My question to you is what platform is the program being written for? Is it Windows, some type of UNIX or Mac? This will make a difference in how you check for the key press being the letter "R". Because each platform is different.
Also at the beginning of the while loop you are wanting to check if "R" has been pressed, but you have done nothing that requires "R" to be pressed yet.
For the next question starting at line 22. Consider this if "R = -10" the if statement would change that to -9 not what you want. And for the second if statement if "R = 10" you would end up with 9 for "R". This might be closer to what you want:
1 2 3 4 5 6 7 8 9
|
if (R < 1)
{
R = 0;
}
if (R > 1) // <--- "=" would be a better choice. Or ">=".
{
R = 1;
}
|
After line 38 consider a cout statement to prompt the user for the new input instead of a blank screen, so to speak, waiting for something. And the same for the while loops for "Y" and "Z".
Line 57 creates an endless loop because the is no change to "R".
Line 61 could use a "\n" or "endl", so everything does not run together.
Line 75 you might want to write that as:
"\nend\n"
. The first "\n" just some extra space before "end" so it is easier to read.
After working with this program maybe you could describe what the program is supposed to do and what you want it to do.
Hope that helps,
Andy