Enter twice to stop program

How do i make my program stop only when it has scanned two blank lines with getline(cin,input);. Right now it stops after enter is pressed as input but i need it to read a blank line then stop when enter is pressed again.
Probably your program is doing some sort of input of values and that is the context in which you ask? It does depend on what you are trying to do.

Here's an example of a simple program which requires the user to press enter twice.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <iostream>
#include <limits>

using namespace std;

void wait_for_enter()
{
    std::cout << "\nPress ENTER to continue...";
    std::cin.ignore( std::numeric_limits<std::streamsize>::max(), '\n' );    
    std::cin.ignore( std::numeric_limits<std::streamsize>::max(), '\n' );    
}

int main() 
{    
    cout << "Hello World!";
    
    
    wait_for_enter();
}
Press Enter twice to terminate input:
http://www.cplusplus.com/forum/beginner/2409/#msg9254
Topic archived. No new replies allowed.