473,406 Members | 2,378 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

ive got caught in a forever loop

Hello,

I was wondering if anyone could help me out. I have devised a wee
menu system with 5 options. the way to select an option is to select
a number 1 - 5 and then there is a switch block to implement some code
depending on the selection. before the program goes into the switch i
have an if statement which checks the see if the input from the user
is greater than 5 "if(choice > 5)" if so then it calls the main
function and goes back to the start. If not then it goes into the
switch statement.

The problem is that if the user enters a letter as their choice
instead of a number the program goes into a forever loop and keeps
displaying the menu over and over again.

I was wondering if anyone know how I could test to see if the entry by
the user was either greater than 5 or not numerical in value.

Thanks and regards

John
Jul 23 '05 #1
1 1378
Sokar wrote:
I was wondering if anyone could help me out. [...]


This is covered in the FAQ. Please read FAQ before posting.
You can find it here: http://www.parashift.com/c++-faq-lite/
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Robert Stearns | last post by:
While attempting to alleviate a persistent but not consistent problem with my database operation (DB2) I coded the do...while loop around my odbc_connect. When $dbConn is false the first time, the...
0
by: Brent Wege | last post by:
Hey guys, kinda scratching my head on this one. Each of these insert queries takes about 1 second in QA, but when I decide to loop it 100 times instead of manually inserting it 100 times, it will...
0
by: Cable | last post by:
Greetings, We have a production website, and within that website we have an 'Admin' section of the website. Two separate ASP.NET/C# web applications. Recently when trying to log into the admin...
2
by: trint | last post by:
I need to know what the safest way to loop(without starting off in a new thread since UI controls are involved) is...and how to pause in the loop so that the program runs normally. Any help is...
6
by: alessandro | last post by:
Hi all, This is my framework for create TCP server listening forever on a port and supporting threads: import SocketServer port = 2222 ip = "192.168.0.4"
3
by: wildThought | last post by:
I want to be able to catch an exception and KEEP PROCESSING with in the try block. In my application, I may receive bad data in a particular file line and want to keep processing the rest of the...
2
by: Will2k | last post by:
I am trying to make this function keep going on until I call an interrupt or, delete function in my GCC. HEre is what I have. I tried putting a while(1) loop in my driver.c but it does not stop. ...
7
by: Jim Michaels | last post by:
As first I was getting "PHP Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0" errors in my server log. so I gave the file permissions. now the browser sits there...
4
by: grayaii | last post by:
There are so many threads on this subject, but I ran across a situation on Windows that I can't figure out. I'm trying to run this little command-line exe and when I launch like this, it hangs:...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.