Why is it, that you have to use two lines like:

cin.ignore;

cin.ignore;

or one time:

cin.ignore(2);

to make the console window wait for a keypress.

One cin.ignore, doesn't seem to do the work

Code:/************************************************************** * This program sums the numbers in a user-specified range, * * omitting the if test that sets the upper and lower bounds. * **************************************************************/ #include <iostream> using std::cin; using std::cout; using std::endl; int main() { int Num_1; int Num_2; int Num_one = 0; int Num_two = 0; int Range = 0; cout << "Exercise 1.20:" << endl << endl; cout << "Enter two numbers !" << endl << endl; cout << "Enter number one: "; cin >> Num_one; Num_1 = Num_one; cout << "Enter number two: "; cin >> Num_two; Num_2 = Num_two; if ( Num_1 < Num_2 ) for ( Num_one = Num_one ; Num_one <= Num_two ; ++Num_one ) { Range += Num_one; if ( Num_one >= Num_two ) { cout << endl << "The sum of all numbers from " << Num_1 << " to " << Num_2 << " is: " << Range << endl; } } // else if ( Num_one > Num_two ) // This works, but I "haven't learned" this // technique yet... if ( Num_1 >= Num_2 ) for ( Num_two = Num_two ; Num_two <= Num_one ; ++Num_two ) { Range += Num_two; if ( Num_one <= Num_two ) { cout << endl << "The sum of all numbers from " << Num_1 << " to " << Num_2 << " is: " << Range << endl; } } cout << endl << "Press [Enter] to exit... ;-)" << endl; cin.ignore(2); // To make the console window, wait for a keypress ! return 0; }