Update DBAppV2.cpp
Fully functional transition of menu states
This commit is contained in:
parent
2d2e056731
commit
1e36326af8
1 changed files with 80 additions and 63 deletions
143
DBAppV2.cpp
143
DBAppV2.cpp
|
@ -1,16 +1,15 @@
|
|||
#include <iostream>
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
/*
|
||||
|
||||
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;
|
||||
//somehow display user information
|
||||
// int choice;
|
||||
// cin>>choice;
|
||||
cout<<"0. Return to main menu"<<endl;
|
||||
cout<<"\n\nEnter choice:";
|
||||
|
||||
|
@ -18,49 +17,46 @@ void yourAccount()
|
|||
|
||||
void goToBoard()
|
||||
{
|
||||
cout<<"*********************************"<<endl;
|
||||
cout<<"Board x"<<endl;
|
||||
// int choice;
|
||||
// cin>>choice;
|
||||
cout<<"*********************************\n"<<endl;
|
||||
|
||||
cout<<"0. Return to main menu"<<endl;
|
||||
cout<<"3. back to board menu"<<endl;
|
||||
cout<<"\n\nEnter choice:";
|
||||
|
||||
}
|
||||
|
||||
void boardList()
|
||||
{
|
||||
cout<<"Showing all boards:"<<endl;
|
||||
// int choice;
|
||||
// cin>>choice;
|
||||
cout<<"\n\nShowing all boards:"<<endl;
|
||||
|
||||
|
||||
cout<<"0. Return to main menu"<<endl;
|
||||
cout<<"3. Return to board menu"<<endl;
|
||||
cout<<"\n\nEnter choice:";
|
||||
|
||||
}
|
||||
|
||||
|
||||
void BoardMenu()
|
||||
void boardMenu()
|
||||
{
|
||||
int choice;
|
||||
cin>>choice;
|
||||
cout<<"Boards will be displayed soon"<<endl;
|
||||
//do some stuff to display boards
|
||||
cout<<"1. List of boards"<<endl;
|
||||
cout<<"2. Go to board (enter shortcut[first few characters])"<<endl;
|
||||
cout<<"*********************************"<<endl;
|
||||
cout<<"Board Menu"<<endl;
|
||||
cout<<"*********************************\n"<<endl;
|
||||
cout<<"\n\n4. List of boards"<<endl;
|
||||
cout<<"5. Go to board (enter shortcut[first few characters])"<<endl;
|
||||
cout<<"0. Return to main menu"<<endl;
|
||||
cout<<"\n\nEnter choice:";
|
||||
switch(choice)
|
||||
{
|
||||
case 1: boardList();
|
||||
case 2: goToBoard();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void showMessages()
|
||||
{
|
||||
cout<<"Messages will be displayed soon"<<endl;
|
||||
//do some stuff to display messages
|
||||
// int choice;
|
||||
// cin>>choice;
|
||||
cout<<"0. Return to main menu"<<endl;
|
||||
|
||||
cout<<"\n0. Return to main menu"<<endl;
|
||||
cout<<"\n\nEnter choice:";
|
||||
|
||||
}
|
||||
|
@ -68,38 +64,64 @@ void showMessages()
|
|||
void showGroups()
|
||||
{
|
||||
cout<<"Groups will be displayed soon"<<endl;
|
||||
//do some stuff to display groups
|
||||
// int choice;
|
||||
// cin>>choice;
|
||||
cout<<"0. Return to main menu"<<endl;
|
||||
|
||||
cout<<"\n0. Return to main menu"<<endl;
|
||||
cout<<"\n\nEnter choice:";
|
||||
|
||||
}
|
||||
|
||||
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:";
|
||||
|
||||
}
|
||||
|
||||
void mainMenu()
|
||||
{
|
||||
|
||||
|
||||
cout<<"***************"<<endl;
|
||||
cout<<"** Main Menu **"<<endl;
|
||||
cout<<"***************\n\n"<<endl;
|
||||
cout<<"1. Your account"<<endl;
|
||||
cout<<"2. Boards"<<endl;
|
||||
cout<<"3. Messages"<<endl;
|
||||
cout<<"4. Groups\n"<<endl;
|
||||
cout<<"Enter choice: ";
|
||||
int choice;
|
||||
cin>>choice;
|
||||
|
||||
switch (choice)
|
||||
{
|
||||
case 1: yourAccount();
|
||||
case 2: BoardMenu();
|
||||
case 3: showMessages();
|
||||
case 4: showGroups();
|
||||
}
|
||||
|
||||
|
||||
cout<<"\n\n***************"<<endl;
|
||||
cout<<"** Main Menu **"<<endl;
|
||||
cout<<"***************\n"<<endl;
|
||||
cout<<"\n6. Your account"<<endl;
|
||||
cout<<"3. Boards"<<endl;
|
||||
cout<<"2. Messages"<<endl;
|
||||
cout<<"1. Groups\n"<<endl;
|
||||
cout<<"8. Logout\n"<<endl;
|
||||
cout<<"Enter choice: ";
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
|
@ -107,20 +129,15 @@ int main()
|
|||
cout<<"Welcome to our BBS "<<endl;
|
||||
cout<<"***************************************"<<endl;
|
||||
|
||||
cout<<"** Enter BBS **"<<endl;
|
||||
cout<<"1. Login"<<endl;
|
||||
cout<<"2. Request new account\n\n";
|
||||
cout<<"Enter choice: ";
|
||||
eventHandler(8);
|
||||
|
||||
int choice;
|
||||
cin>>choice;
|
||||
|
||||
|
||||
if (choice == 1)
|
||||
{
|
||||
cout<<"ramera"<<endl;
|
||||
mainMenu();
|
||||
}
|
||||
else {cout<<"oops";}
|
||||
while (choice != -1)
|
||||
{
|
||||
cin>>choice;
|
||||
eventHandler(choice);
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
*/
|
||||
|
|
Reference in a new issue