View Single Post
  #5   Spotlight this post!  
Unread 07-12-2011, 21:41
calcmogul's Avatar
calcmogul calcmogul is offline
WPILib Developer
AKA: Tyler Veness
FRC #3512 (Spartatroniks)
Team Role: Mentor
 
Join Date: Nov 2011
Rookie Year: 2012
Location: Santa Maria, CA
Posts: 52
calcmogul is just really nicecalcmogul is just really nicecalcmogul is just really nicecalcmogul is just really nice
Re: Press Enter to Add One

You can write this with a for loop too, which has variable incrementing built in:
Code:
#include <iostream> //has cout

for ( int count = 1 ; count <= 10 ; count++ ) {
    system("pause"); //waits for user to press enter
    std::cout << "Count: " << count << std::endl;
}
std:: needs to be added to the front of STL functions like cout unless you specify "using namespace std;" at the top of the program.
Reply With Quote