![]() |
| ||
| Input Questions I am working inside a function and am already passing back a value. Inside the function I am using cin to get an int from the user. If they want to quit they type q. The input buffer fails when this happens. I could use an if statement and then clear the buffer but I cant pass back another value. For example int menu( bool hidemenu,int *parr) How could I get around this problem? |
| ||
| Re: Input Questions What is the error that you are getting? Or whats going wrong, how do you know it fails? |
| ||
| Re: Input Questions I just assume that because when I type in q it doesnt let me input anything anymore it just keeps repeating my code without stopping. |
| ||
| Re: Input Questions you are inputting to an int; there's your problem. |
| ||
| Re: Input Questions The int choiceis an int and as q is a char it sends the ascii value you should either make all your choices chars or make q a int like 0. That may solve your problem. |
| All times are GMT -4. The time now is 9:27 pm. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC