#include "conio.h"
class account
{
protected:
int no;
float bal;
public:
void accept ()
{
clrscr ();
cout << "Welcome to bank menu:\n\n";
cout << "----------------------------------------";
cout << endl << "\nEnter Account number:\t";
cin >> no;
cout << endl << "\nEnter Balance:\t\t";
cin >> bal;
}
};
class menu : public account
{
public:
int n;
float am;
void task ()
{
ret: clrscr ();
cout << "Welcome to bank: A\c No.:"<
cout << "----------------------------------------";
cout << endl << "\nSelect one of the following options:\n\n\n\n";
cout << endl << "1. Deposite\t2. Withdraw\t3. check Balence\t4. Quit\n\n";
cin >> n;
if (n == 1)
{
cout << "\n\n----------------------------------------\n\n";
cout << endl << "\nEnter Amount:\t";
cin >> am;
bal += am;
goto ret;
}
else if (n == 2)
{
cout << "\n\n----------------------------------------";
cout << endl << "\nEnter Amount:\t";
cin >> am;
if(am<=bal)
bal -= am;
else
{
cout<<"You donot have sufficient balance\n";
getch();
}
goto ret;
}
else if (n == 3)
{
cout << "\n\n----------------------------------------";
cout << endl << "\nAmount:\t" << bal;
getch ();
goto ret;
}
else if (n == 4)
return;
else
goto ret;
}
};
void main ()
{
menu M;
M.accept ();
M.task ();
}
Get the executable ( .exe ) file for this program..
Download
0 comments:
Post a Comment