-
Score Entering
I'm having troubles with a program of mine, I'm trying to create code that will let a user enter scores but stop entering the scores when they type a certain number, I have everything working in this program except for my function where I enter the numbers. I can enter numbers but when i type -1 to go back to the main menu it doesn't do much, I would appreciate if someone could get me a little code for this function. Thanks for your time
-
how are you determining if its -1, your using an if statement right?
-
Yes, I am using an if statement. And I am just using -1 as an example, anything will do.
-
Code:
int scores = 0;
cin>>scores;
while ( scores != -1 ) {
// Process the score
cin>>scores;
}
-Prelude
-
I used your idea but it still wasn't working right, I finally figured out though that i needed (i-1 != -1) instead of (i != 0) but the suggestion above made it alot easier also, thank you all very much.