Need some HELP for homework

I have no idea how do i start this work.
can anyone just help me out?
i want to know what are the functions code i can use.

Menu System
You are required to implement a C++ program that provides a simple menu system for a new text
based game. An example of the menu system is shown below:
WELCOME TO THE SIMPLE TEXT GAME!
Please select from one of the following options:
1: Play
2: Help
3: Options
4: Quit
Enter (1,2,3 or 4 only): q
ERROR: You did not enter an integer value?! Please try again!
Please select from one of the following options:
1: Play
2: Help
3: Options
4: Quit
Enter (1,2,3 or 4 only): 9
ERROR: Invalid option selected! Please select from 1,2,3 or 4
Please select from one of the following options:
1: Play
2: Help
3: Options
4: Quit
Enter (1,2,3 or 4 only): 2
>> HELP Menu Item Selected!
>> Continuing with program
Please select from one of the following options:
1: Play
2: Help
3: Options
4: Quit
Enter (1,2,3 or 4 only): 1
>> PLAY Menu Item Selected!
>> Playing game...
>> Continuing with program
Please select from one of the following options:
1: Play
2: Help
3: Options
4: Quit
Enter (1,2,3 or 4 only): 4
>> QUIT Menu Item Selected!
>> Quitting the game...
Goodbye!

In your implementation, the program must be able to handle cases where the user provides invalid
input (both a non-numeric input and an invalid number, as shown above). Each of the selected
actions should be implemented as functions, where in this example all they do is display the
appropriate text.
i want to know what are the functions code i can use.

Please, explain what you mean by "functions code".

Is the "can use" a reference to a practice of some institutes to forbid the use of some standard library features, because the purpose of the exercises is to learn to think logically rather than to produce applications? We don't know the rules of your course.


You apparently should do in a loop:
1. get input from user
2. check validity of input
3. call appropriate function for inputs 1, 2, and 3
4. exit loop, if input is 4
This is what i got is a similar one but i try to change the number of options but it can't
can you please rewrote for me?
#include <iostream>
#include <cstdlib>


using namespace std;

void menu();
void mainMenu();
void optionsMenu();
void options();
int choice1 = 0;
int choice2 = 2;
int choice3 = 3;
int choice4 = 0;

int main(int argc, char** argv) {
menu();
return 0;
}

void menu()
{ do
{
choice2 = 2;
mainMenu();

switch(choice2)
{
case 1:
cout << "GAME STARTED";
break;

case 2:
options();
break;

case 3:
break;

}

} while(choice1 != 3);


}

void options(void)
{
cout <<"Audio\n";
cout <<"Sound\n";
cout <<"Keys\n";


}

} while(choice3 != 3);


}

void mainMenu(void)
{
cout << "Main Menu\n";
cout << "1: Play\n";
cout << "2: Help\n";
cout << "3: Options\n";
cout << "4: Quit\n";
cout << "Please choose: ";
cin >> choice1;
}

void helpMenu(void)
{
cout << " Movment W up, S down, A left, D right and spacebar Jump.\n"
cin >> choice2
}

void optionsMenu(void) {



cout << "Options Menu\n";
cout << "1 - Difficulty\n";
cout << "2 - Sound";
cout << "3 - Back\n";
cout << "Please choose: ";
cin >> choice3;

}
Topic archived. No new replies allowed.