Mail Archives: djgpp/1998/01/03/00:46:10
The usual "I'm new to C++" statements here....
I'm working on a program that requires a bit of input from the user:
while (ge<0 | ge>1000)
{
gotoxy(10,4); cout<<"What is the germanium concentration (in g/l)?\n";
gotoxy(70,4); cin>>ge;
}
This works fine until someone enterssomething like a "w". Then it goes
into an loop that can only be exited by the ctrl-brk key. Is there a way
to check for this and stop the loop from starting?
Also, after several more of these loops asking for other data, I ask for a
line of comments, viz:
gotoxy(10,15); cout <<"Please enter any other relevent comments....\n";
gotoxy(15,16); cin.getline(comm,65);
this gets skipped each time and the comments array is blank. The same type
of statements work fine earlier in the program. Any ideas why it works
before the cin statements but not after?
tia for any help.
---
DamnULP
- Raw text -