|
Re: Press Enter to Add One
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
std::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?
Last edited by plnyyanks : 07-12-2011 at 21:47.
Reason: forgot "std::" - good catch. or, put "using namespace std;" at the top of the program
|