here's my code:
#include <cstdlib>
#include <conio.h>
#include <iostream>
using namespace std;
void startMenu();
void newAccountMenu();
//------------------------------------------------------------------------------
int main(int argc, char *argv[])
{
int pinCode;
int count = 2;
cout << "Please enter your PIN code: ";
cin >> pinCode;
do
{
if ( pinCode != 5555 && count > 0 )
{
system("cls");
cout << "PIN incorrect, you have " << count << " more tries left: ";
cin >> pinCode;
count--;
}
if ( count == 0 )
{
system("cls");
cout << "Sorry, you've got your PIN wrong too many times!" << endl
<< "Please see someone inside the bank.";
break;
}
} while ( pinCode != 5555 );
if ( pinCode == 5555 )
{
system("cls");
cout << "Correct pin, fowarding you to bank menu, click to continue.";
getch();
system("cls");
startMenu();
}
getch();
return 0;
}
//------------------------------------------------------------------------------
void startMenu()
{
int choice;
cout << "\t\t|--------------------------------------------------|" << endl
<< "\t\t|Welcome to Bank Syms, please enter your selection:|" << endl
<< "\t\t|--------------------------------------------------|" << endl
<< "\t\t| 1. Register - New Customer |" << endl
<< "\t\t| 2. Withdraw |" << endl
<< "\t\t| 3. Deposit |" << endl
<< "\t\t| 4. Balance |" << endl
<< "\t\t| 5. Exit |" << endl
<< "\t\t|--------------------------------------------------|" << endl
<< "\t\t Selection: ";
choice = getch();
while ( choice != 53 )
{
switch ( choice )
{
case '1' :
system("cls");
newAccountMenu();
getch();
break;
}
}
}
//------------------------------------------------------------------------------
void newAccountMenu()
{
cout << "\t\t|--------------------------------------------------|" << endl
<< "\t\t| Hello and welcome to the new account menu: |" << endl
<< "\t\t|--------------------------------------------------|" << endl
<< "\t\t| 1. Register checking account |" << endl
<< "\t\t| 2. Register savings account |" << endl
<< "\t\t| 3. Register checking and savings account |" << endl
<< "\t\t| 4. Return to top menu |" << endl
<< "\t\t|--------------------------------------------------|" << endl
<< "\t\t Selection: ";
}
//------------------------------------------------------------------------------
Cheers in advance...!

New Topic/Question
Reply



MultiQuote




|