Hello everybody,
I'm back, started my 2nd year at Uni now and started programming in the wonder that is C++ and enjoying it tremendously.
but I've hit a slight problem, not with code but with design.
I'm not sure where to put the input/output, sounds weird but I'll elaborate.
i have all my base classes sorted i have a Bank class which contains arrays of Accounts and Customers and contains all the functions required to add/delete/display accounts and customers.
its only a simple console application using a simple menu and the user simply enters a number 1 - 9 (as a char) to navigate the menu.
what i'm confused about is where to put the menu output and where to read the menu input, do i put it all in my bank class or to i put it in my main class.
my original idea was to have all of the menu output in functions within the bank class; for example.
void Bank::mainMenu()
{
do
{
char menu;
system("cls");
draw();
cout << "Main Menu" << endl;
draw();
cout << "1 - Accounts Menu" << endl;
cout << "2 - Cards Menu" << endl;
cout << "3 - Lending Menu" << endl;
cout << "4 - Investements Menu" << endl;
cout << "5 - Exit" << endl;
draw();
cout << "Please Make Your Choice: ";
cin >> menu;
switch (menu)
{
case '1':
accMenu();
break;
case '2':
cardMenu();
break;
// only showing a couple you get the point :P
}
}while(menu != '5');
}
with this method i would call the mainMenu function on a bank object in my main.cpp file and that mainMenu function would do all the output input and validation and then display the next menu. therefore my main function would probably look something like this
int main ()
{
Bank b;
b.mainMenu();
//End Sequence
cin.ignore(1000, '\n'); //Ignores all input up till next line
cout << "Press Enter to Continue" << endl;
cin.get(); //makes the program wait before continuing
}
but i'm worried that this would be going against oop concepts and i'm just wondering what other members of the community think.
Thanks in advance for any help
-Midi