View Single Post
  #3   Spotlight this post!  
Unread 07-12-2011, 20:56
Andrew Lawrence
 
Posts: n/a
Re: Press Enter to Add One

Quote:
Originally Posted by plnyyanks View Post
Try something like this:

Code:
//make sure you #include <iostream>
int count = 0; //variable to store count
while(count < 10){ //this will only run 10 times
    system("pause"); //wait for user to press enter - this will send the Windows shell command "pause", and wait for the user to press enter
    count++; //increment count
    cout << "Count: " << count << endl; //show count to user
}
You'll need a variable to store the running count, and after the user presses enter, it'll have to be incremented. Does that snippet make sense logically?
Trust Phil. He knows this stuff.
Reply With Quote