Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Apr 14, 2011, 09:32 PM   #1
CsRookie
macrumors newbie
 
Join Date: Apr 2011
C programming, menu?

How would one go about creating a menu for a c program? The menu would allow the user to select where they want to go in the program. For example:

1)View Inventory
2)Add Inventory
3)Remove Inventory
4)Save
5)Exit

Something along those lines and the user would input 1-5 and then it would take them to the next part of the program. How would a menu driven program work? I tried the search but no luck, any links to examples or simple explanation would be greatly appreciated.

Last edited by CsRookie; Apr 14, 2011 at 09:58 PM.
CsRookie is offline   0 Reply With Quote
Old Apr 14, 2011, 09:46 PM   #2
jiminaus
macrumors 65816
 
Join Date: Dec 2010
Location: Sydney
Something like the following pseudo-code:

Code:
Initialize program
Loop
  Print menu on screen
  Read menu choice from keyboard
  If menu choice is 1 then do view inventory
  If menu choice is 2 then do add inventory
  (etc.)
  If menu choice is 5 then exit loop
End loop
Cleanup program
In terms of implementing this, you'd probably do this all in main, and define separate functions to implement "do view inventory", "do add inventory", etc.
jiminaus is offline   0 Reply With Quote
Old Apr 14, 2011, 09:58 PM   #3
CsRookie
Thread Starter
macrumors newbie
 
Join Date: Apr 2011
Quote:
Originally Posted by jiminaus View Post
Something like the following pseudo-code:

Code:
Initialize program
Loop
  Print menu on screen
  Read menu choice from keyboard
  If menu choice is 1 then do view inventory
  If menu choice is 2 then do add inventory
  (etc.)
  If menu choice is 5 then exit loop
End loop
Cleanup program
In terms of implementing this, you'd probably do this all in main, and define separate functions to implement "do view inventory", "do add inventory", etc.
Thanks for the quick response, I thought it may be a loop but wasn't sure. Thank you again
CsRookie is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Account name in the menu bar danakm Mac OS X 10.7 Lion 9 Jul 21, 2011 07:39 AM
How can I force a bootcamp menu on boot? ryanflucas Windows, Linux & Others on the Mac 2 May 25, 2011 07:38 PM
Apple Menu Bar: Mouse-over auto hide and show zdlyons OS X 8 Feb 27, 2011 01:51 PM
How can I stop mac menu bar appearing in games polo3400 Mac and PC Games 4 Feb 17, 2011 04:31 PM
Screen resolution problems results in double menu bar frannyy MacBook 0 Nov 6, 2010 09:03 AM


All times are GMT -5. The time now is 01:46 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC