![]() |
|
#1
|
|||
|
|||
Ensure Correct Data Is EnteredHi, can I know the coding for the below situation.
Basically, I want to ask the user to enter the desired data, for instance name. Then I proceed to ask the user to enter his age (between a certain range). The problem is that how do I prompt the user to reenter the correct data, while clearing the data that has been previously entered and displayed, and at the same time, make sure that his name is not cleared. It goes something like this................. __________________________________________________ _______________ Please enter your name: Jack Johnson Please enter your age : 900 You entered over 100 years. Enter again. __________________________________________________ _______________ Since data entered is not in the allowable range, prompt the user to enter again. __________________________________________________ _______________ Please enter your name: Jack Johnson Please enter your age : __________________________________________________ _______________ All I know is that only one command can be used to clear the screen, ie, system("cls"). But if I use this, it will clear the first line as well. Please help. |
|||
|
#2
|
|||
|
|||
Re: Ensure Correct Data Is EnteredQuote:
|
|
#3
|
||||
|
||||
Re: Ensure Correct Data Is EnteredAt a known point in the program, at the point of entering the age for example, one possibility after to clearing the screen is to redraw everything back to the age prompt. Something like this pseudo-code: (note this is only a suggestion, other ways are possible, as ocicat pointed out)
Code:
__________________
Use the force...read the source!! WYCIWYG -- what you code is what you get! |
Recent GIDBlog
Problems with the Navy (Enlisted) by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Memory leak when nothing is happening... How can I even debug this ? | Algar | MS Visual C++ / MFC Forum | 10 | 19-Nov-2007 07:17 |
| [Include] Doubly-linked List | dsmith | C Programming Language | 6 | 14-Apr-2006 13:12 |
| Strange C++ code memory leakage problem | gaoanyu | C++ Forum | 7 | 04-Nov-2005 08:09 |
| [GIM] Data Module - Contact | dsmith | C Programming Language | 2 | 27-Jan-2005 16:30 |
| [CONTEST?]Data Structure Test | dsmith | C Programming Language | 2 | 06-Jun-2004 15:13 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The