/**************************************************************
* This program sums the numbers in a user-specified range, *
* omitting the if test that sets the upper and lower bounds. *
**************************************************************/

You typically don't use a cin.ignore to wait for a key press - you
use cin.get. The thing is, when you read in a value using
cin >> variable, say an int, when you press the enter key, the
enter key is left in the input buffer. The call to cin.ignore just
reads that value and discards it - if you use cin.ignore (2), and
there is only one character in the buffer, it'll wait for another
character (newline I mean) - thats's why you need cin.ignore (2).
Since there is typically only one newline in the buffer, the usual
format is:

Code:

//body of program

.
.
.

cin.ignore ();
cin.get ();

07-16-2006

The SharK

Hi Richie T

Oh, I see !

So I'll use:

Code:

cin.ignore();
cin.get();

To make my program discard the "Enter" keypress, and
then use cin.get() to wait for the new keypress "Enter/newline" ;)