Link to home
Start Free TrialLog in
Avatar of SteveoReno
SteveoReno

asked on

What is the code to account for a user's erroneous input of the 'enter' key when the 'enter' key is not a menu item?

I'm certain this is a very simple programming question. I have awarded it the high number of points because it is somewhat urgent to me.  During a search on this site for another problem solution, I encountered the answer to this question.  But, unfortunately I cannot now retrace my steps to retrieve the necessary information to solve this problem.

Problem: User chooses to depress the 'Enter' key when presented with a menu list that does not include pressing the 'Enter' key w/o first selecting a menu choice.  
              In a section of the code during an 'else if' portion of a 'while' statement, I have accounted for incorrect non-menu item choices.  I simply do not see how  
              to allow for the 'Enter' key as an error in the program code.  

Program:

while (1)
//several if statements...              
program snipped for brevity...
else if //menu choice is not from the menu list accounted for here in program such as a zero input when zero is not a legitimate menu choice
                                                                                                                                                               (this portion answered/solved)
       if //the illegitimate menu choice is the 'Enter' key only
               what is the specific code to account for that error input? (here is the crux of this question)

As I did a Google search I thought I read that '\r' are the characters that C language recognizes as the 'Enter' key.  However, this code incorporated in the above 'else if' statement gives my Miracle C compiler a compilation error.

My environment: MS Windows XP Pro Multimedia Editionwith Service Pack 2 w/plenty of speed, memory & space.  As mentioned above, I am using the Miracle C Worbench.  I thank you in advance for your assistance.
   
SOLUTION
Avatar of sunnycoder
sunnycoder
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of SteveoReno
SteveoReno

ASKER

Sunnycoder & JKR:

Thank you both so much!  I appreciate your input & help.