Original Post
how do i make sub menus for a main menu
iv bein trying to do this for 3 days now by my self with books and i was trying it with the while and switch statments but they only work so far how can i do this
i kno its a dumb question lol most of u r like damn he doesnt kno this what a fag lol
someone plz help!!!!!
(this is what i have( i erased some stuff cuz it didnt work so i have the basic thing)
#include "stdafx.h"
#include "iostream"
#include "ctime"
#include "stdio.h"
int main()
{
using namespace std;
int menu;
do
{
cout << "==============================" << endl;
cout << "|| MAIN MENU ||" << endl;
cout << "==============================" << endl;
cout << "||Please make a selection: ||" << endl;
cout << "||1. create a character ||" << endl;
cout << "||2. shop ||" << endl;
cout << "||3. view stats ||" << endl;
cout << "||4. enter death arena ||" << endl;
cout << "||5. quit game ||" << endl;
cout << "============================== \n" << endl;
cin >> menu;
} while (menu != 1 && menu != 2 &&
menu != 3 && menu != 4 && menu != 5);
switch selection (menu)
{
case 1:
// sub menu character
cout << "" << endl; // space to look better
cout << "==============================" << endl;
cout << "|| CHARACTER MENU ||" << endl;
cout << "==============================" << endl;
cout << "||1. name your character ||" << endl;
cout << "||2. roll for stats ||" << endl;
cout << "||3. back to main menu ||" << endl;
cout << "============================== \n" << endl;
break;
case 2:
//sub menu shop
cout << "" << endl; // space to look better
cout << "==============================" << endl;
cout << "|| SHOP MENU ||" << endl;
cout << "==============================" << endl;
cout << "||1. purchase armor ||" << endl;
cout << "||2. purchase weapon ||" << endl;
cout << "||3. back to main menu ||" << endl;
cout << "==============================" << endl;
break;
case 3:
//sub menu shop
cout << "" << endl; // space to look better
cout << "==============================" << endl;
cout << "|| VIEW STATS ||" << endl;
cout << "==============================" << endl;
cout << "||1. name: ||" << endl;
cout << "||2. level: ||" << endl;
cout << "||3. strength: ||" << endl;
cout << "||4. dexterity: ||" << endl;
cout << "||5. constitution: ||" << endl;
cout << "||6. HP: ||" << endl;
cout << "||7. exp: ||" << endl;
cout << "||8. gold: ||" << endl;
cout << "||9. exit menu ||" << endl;
cout << "==============================" << endl;
break;
}
return 0;
}
[Edited by - jpetrie on June 9, 2010 12:31:25 AM]
iv bein trying to do this for 3 days now by my self with books and i was trying it with the while and switch statments but they only work so far how can i do this
i kno its a dumb question lol most of u r like damn he doesnt kno this what a fag lol
someone plz help!!!!!
(this is what i have( i erased some stuff cuz it didnt work so i have the basic thing)
#include "stdafx.h"
#include "iostream"
#include "ctime"
#include "stdio.h"
int main()
{
using namespace std;
int menu;
do
{
cout << "==============================" << endl;
cout << "|| MAIN MENU ||" << endl;
cout << "==============================" << endl;
cout << "||Please make a selection: ||" << endl;
cout << "||1. create a character ||" << endl;
cout << "||2. shop ||" << endl;
cout << "||3. view stats ||" << endl;
cout << "||4. enter death arena ||" << endl;
cout << "||5. quit game ||" << endl;
cout << "============================== \n" << endl;
cin >> menu;
} while (menu != 1 && menu != 2 &&
menu != 3 && menu != 4 && menu != 5);
switch selection (menu)
{
case 1:
// sub menu character
cout << "" << endl; // space to look better
cout << "==============================" << endl;
cout << "|| CHARACTER MENU ||" << endl;
cout << "==============================" << endl;
cout << "||1. name your character ||" << endl;
cout << "||2. roll for stats ||" << endl;
cout << "||3. back to main menu ||" << endl;
cout << "============================== \n" << endl;
break;
case 2:
//sub menu shop
cout << "" << endl; // space to look better
cout << "==============================" << endl;
cout << "|| SHOP MENU ||" << endl;
cout << "==============================" << endl;
cout << "||1. purchase armor ||" << endl;
cout << "||2. purchase weapon ||" << endl;
cout << "||3. back to main menu ||" << endl;
cout << "==============================" << endl;
break;
case 3:
//sub menu shop
cout << "" << endl; // space to look better
cout << "==============================" << endl;
cout << "|| VIEW STATS ||" << endl;
cout << "==============================" << endl;
cout << "||1. name: ||" << endl;
cout << "||2. level: ||" << endl;
cout << "||3. strength: ||" << endl;
cout << "||4. dexterity: ||" << endl;
cout << "||5. constitution: ||" << endl;
cout << "||6. HP: ||" << endl;
cout << "||7. exp: ||" << endl;
cout << "||8. gold: ||" << endl;
cout << "||9. exit menu ||" << endl;
cout << "==============================" << endl;
break;
}
return 0;
}
[Edited by - jpetrie on June 9, 2010 12:31:25 AM]