answersLogoWhite

0

====

'-----------------------------------------------

'*** PROGRAM: Main Menu

' LANGUAGE: QBASIC: VERSION: QB64

'-----------------------------------------------

'------------------------------------------

'*** Global variable declarations list...

'------------------------------------------

userKeyPress$=""

'-----------------------

'*** Main Program...

'-----------------------

DO 'this is a menu driven program...

GOSUB clearScreen

GOSUB printMainMenuTitleHeading

GOSUB printMainMenuOptionsList

GOSUB printMainMenuInstructionsHeading

GOSUB printMainMenuUserInstructions

GOSUB awaitUserKeyPress

GOSUB checkUserKeyPress

LOOP UNTIL UCASE$(userKeyPress$) = "Q" '...UCASE converts lower case to upper

END '...END of program/halt program code execution

'----------------------

'*** Sub-routines...

'----------------------

clearScreen:

CLS '...(CL)ear the output (S)creen

RETURN

printMainMenuTitleHeading:

PRINT "MAIN MENU"

PRINT "========"

RETURN

printMainMenuOptionsList:

PRINT "Hit key: <1> for Program 1: 12 X Tables Square"

PRINT "Hit key: <2> for Program 2: Select a times tables to print out"

PRINT

PRINT "Hit key: <Q> to Quit!"

PRINT

RETURN

printMainMenuInstructionsHeading:

PRINT "USER INSTRUCTIONS"

PRINT "=============="

RETURN

printMainMenuUserInstructions:

PRINT "In order to select from the above Main Menu options list..."

PRINT

PRINT "First, chose the type of program you wish to run..."

PRINT "by, carefully, reading it's description."

PRINT

PRINT "Then, hit a corresponding single number/letter key, either: '1'/'2';"

PRINT "or, alternatively, hit key: 'Q' to Quit!"

PRINT

PRINT "-Thank you!"

RETURN

awaitUserKeyPress:

DO '...keep looping until when user presses any key...

userKeyPress$ = INKEY$ '...store any IN-coming KEY press

LOOP UNTIL userKeyPress$ <> ""

RETURN

checkUserKeyPress:

IF userKeyPress$ = "1" THEN GOSUB program1 '...GO to named SUB-routine

IF userKeyPress$ = "2" THEN GOSUB program2 '...GO to named SUB-routine

RETURN

program1:

GOSUB clearScreen

PRINT "PROGRAM 1"

'(...program 1/code goes here...)

GOSUB awaitUserKeyPress

RETURN

program2:

GOSUB clearScreen

PRINT "PROGRAM 2"

'(...program 2/code goes here...)

GOSUB awaitUserKeyPress

RETURN

User Avatar

Wiki User

12y ago

Still curious? Ask our experts.

Chat with our AI personalities

JudyJudy
Simplicity is my specialty.
Chat with Judy
ProfessorProfessor
I will give you the most educated answer.
Chat with Professor
SteveSteve
Knowledge is a journey, you know? We'll get there.
Chat with Steve

Add your answer:

Earn +20 pts
Q: How do you write main menu pseudo code?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What is the code for creating a menu on pascal?

Well if you want to create a menu, you may use CASE.This is the programprogram Menu;var menu:integer;beginwriteln('Menu');writeln('1. XXXXXXX');writeln('2. XXXXXXX'); {unlimited option you want}writeln; {just to make it pretty :)}write('Mode you want to choose');readln(menu);CASE menu OF1: {program if I choose 1 from the menu};2: {program if I choose 2 from the menu};end; {end of case}readln;end.


What is the difference between a pop up menu and a pull down menu?

Pop up menu: This menu can be displayed anywhere on the page with a right-click of the mouse.Pull down Menu: This menu can be displayed when you click or bring mouse on menu then list of sub menu will be displayed under the main MENU.


Menu driven program in c programming?

You can find the source code of the menu driven graphics program here: http://www.start2code.com/Cresources/menu-driven-graphics-program-c.html


How do you create a menu editor in visual basic 6.0?

Men editor is a most important feacture of any application that enables a large number of commands in a small area. Visual basic provides to creating menu editor in our application. The following step is used to create a menu editor in visual basic 6.0-Click on the 'Tools' menu of VB application window.Select menu Editor from this.A dialogue box is appear. Here we named the menu, named its caption select shortcut for the menu.After doing this click on ok to create your menu.Then after from your menu we select it to write code or event to it for perform a specific operation


How do you make menu using jcreator in java?

Currency Source Code Using JCreator