Update DBAppV2.cpp

Fully functional transition of menu states
This commit is contained in:
William Bracho Blok 2015-10-01 13:38:24 -05:00
parent 2d2e056731
commit 1e36326af8

View file

@ -3,14 +3,13 @@
using namespace std; using namespace std;
/* /*
void yourAccount() void yourAccount()
{ {
cout<<"name: yourName"<<endl; cout<<"*********************************"<<endl;
cout<<"Your Account"<<endl;
cout<<"*********************************\n"<<endl;
cout<<"\n\nname: JOHN CENA"<<endl;
cout<<"other stuff related to this user\n\n"<<endl; cout<<"other stuff related to this user\n\n"<<endl;
//somehow display user information
// int choice;
// cin>>choice;
cout<<"0. Return to main menu"<<endl; cout<<"0. Return to main menu"<<endl;
cout<<"\n\nEnter choice:"; cout<<"\n\nEnter choice:";
@ -18,49 +17,46 @@ void yourAccount()
void goToBoard() void goToBoard()
{ {
cout<<"*********************************"<<endl;
cout<<"Board x"<<endl; cout<<"Board x"<<endl;
// int choice; cout<<"*********************************\n"<<endl;
// cin>>choice;
cout<<"0. Return to main menu"<<endl; cout<<"0. Return to main menu"<<endl;
cout<<"3. back to board menu"<<endl;
cout<<"\n\nEnter choice:"; cout<<"\n\nEnter choice:";
} }
void boardList() void boardList()
{ {
cout<<"Showing all boards:"<<endl; cout<<"\n\nShowing all boards:"<<endl;
// int choice;
// cin>>choice;
cout<<"0. Return to main menu"<<endl; cout<<"0. Return to main menu"<<endl;
cout<<"3. Return to board menu"<<endl;
cout<<"\n\nEnter choice:"; cout<<"\n\nEnter choice:";
} }
void BoardMenu() void boardMenu()
{ {
int choice; cout<<"*********************************"<<endl;
cin>>choice; cout<<"Board Menu"<<endl;
cout<<"Boards will be displayed soon"<<endl; cout<<"*********************************\n"<<endl;
//do some stuff to display boards cout<<"\n\n4. List of boards"<<endl;
cout<<"1. List of boards"<<endl; cout<<"5. Go to board (enter shortcut[first few characters])"<<endl;
cout<<"2. Go to board (enter shortcut[first few characters])"<<endl;
cout<<"0. Return to main menu"<<endl; cout<<"0. Return to main menu"<<endl;
cout<<"\n\nEnter choice:"; cout<<"\n\nEnter choice:";
switch(choice)
{
case 1: boardList();
case 2: goToBoard();
}
} }
void showMessages() void showMessages()
{ {
cout<<"Messages will be displayed soon"<<endl; cout<<"Messages will be displayed soon"<<endl;
//do some stuff to display messages //do some stuff to display messages
// int choice;
// cin>>choice; cout<<"\n0. Return to main menu"<<endl;
cout<<"0. Return to main menu"<<endl;
cout<<"\n\nEnter choice:"; cout<<"\n\nEnter choice:";
} }
@ -68,10 +64,19 @@ void showMessages()
void showGroups() void showGroups()
{ {
cout<<"Groups will be displayed soon"<<endl; cout<<"Groups will be displayed soon"<<endl;
//do some stuff to display groups
// int choice; cout<<"\n0. Return to main menu"<<endl;
// cin>>choice; cout<<"\n\nEnter choice:";
cout<<"0. Return to main menu"<<endl;
}
void newAccount()
{
cout<<"*********************************"<<endl;
cout<<"Request new account"<<endl;
cout<<"*********************************\n"<<endl;
cout<<"\n\nNew account generated"<<endl;
cout<<"\n8. Return to login menu"<<endl;
cout<<"\n\nEnter choice:"; cout<<"\n\nEnter choice:";
} }
@ -80,26 +85,43 @@ void mainMenu()
{ {
cout<<"***************"<<endl; cout<<"\n\n***************"<<endl;
cout<<"** Main Menu **"<<endl; cout<<"** Main Menu **"<<endl;
cout<<"***************\n\n"<<endl; cout<<"***************\n"<<endl;
cout<<"1. Your account"<<endl; cout<<"\n6. Your account"<<endl;
cout<<"2. Boards"<<endl; cout<<"3. Boards"<<endl;
cout<<"3. Messages"<<endl; cout<<"2. Messages"<<endl;
cout<<"4. Groups\n"<<endl; cout<<"1. Groups\n"<<endl;
cout<<"8. Logout\n"<<endl;
cout<<"Enter choice: "; cout<<"Enter choice: ";
int choice;
cin>>choice;
switch (choice)
{
case 1: yourAccount();
case 2: BoardMenu();
case 3: showMessages();
case 4: showGroups();
}
} }
void loginMenu()
{
cout<<"\n\n** Enter BBS **"<<endl;
cout<<"0. Login"<<endl;
cout<<"7. Request new account\n\n";
cout<<"-1. Exit\n\n"<<endl;
cout<<"Enter choice: ";
}
void eventHandler(int choice)
{
switch(choice)
{
case 0: mainMenu(); break;
case 1: showGroups(); break;
case 2: showMessages(); break;
case 3: boardMenu(); break;
case 4: boardList(); break;
case 5: goToBoard(); break;
case 6: yourAccount(); break;
case 7: newAccount(); break;
case 8: loginMenu(); break;
}
};
int main() int main()
{ {
@ -107,20 +129,15 @@ int main()
cout<<"Welcome to our BBS "<<endl; cout<<"Welcome to our BBS "<<endl;
cout<<"***************************************"<<endl; cout<<"***************************************"<<endl;
cout<<"** Enter BBS **"<<endl; eventHandler(8);
cout<<"1. Login"<<endl;
cout<<"2. Request new account\n\n";
cout<<"Enter choice: ";
int choice; int choice;
cin>>choice;
if (choice == 1) while (choice != -1)
{ {
cout<<"ramera"<<endl; cin>>choice;
mainMenu(); eventHandler(choice);
} }
else {cout<<"oops";}
} }
*/ */