RE: Implimenting prompts in program for reinput from user?

  • From: "Joseph Lee" <joseph.lee22590@xxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Tue, 20 Jul 2010 03:51:39 -0700

Hi,
If I remember right, you would use while loop and conditional statements
inside the loop until the correct values are entered. A pseudo code might
be:
while (the numbers are not between 1 and 3) // Try using "&&" operator.
{
/* The conditional statements to check the user input.
If it is not the value that the program is looking for, display the error
and prompt the user to enter the values again.
If it is the value that the program is looking for, exit the loop. */
}
Cheers,
Joseph

-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Jes
Sent: Tuesday, July 20, 2010 3:36 AM
To: programmingblind@xxxxxxxxxxxxx
Subject: Implimenting prompts in program for reinput from user?

Say I want a user to enter a number from 1 to 3, but they enter something
else, like 4, or the letter v, or whatever. How would I tell the program to
display an error message to the user using cout, then return them to the
initial prompt?
Thanks.
Jes

__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 8.5.441 / Virus Database: 271.1.1/3015 - Release Date: 07/19/10
18:36:00

__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

Other related posts: