This has probably been answered somewhere, I just can seem to find an answer to it. Anyways, I am making a program that loops a certain number for times, however I would like the program to take the input of the user after they have hit a space bar to trigger the fact the user will be inputting something. Now my logic maybe off but this is what I am trying.
for ( int i = 0 ; i < length (user input from before); i++){
do{
cout << "Hello World" << endl;
}while(cin.getch() == ' ');
}
From what I see the program doing, it stops each time my iterator is increased. I'm kinda sure the logic on why it's stopping each time but how do I make it so it loops and only stops when the user hits the space key?