#include "Account.hpp"
Account::Account()
{
}
Account::Account(int *nstr)
{
int j = 1;
int withdrawMoney ,depositMoney;
cout %26lt;%26lt; "\n\n**** press 1 to withdraw money ****\n " ;
cout %26lt;%26lt; "\n**** press 2 to deposit money ****\n " ;
cout %26lt;%26lt; "\n**** press 0 to exit and return to main menu ****\n " ;
cout %26lt;%26lt; "\n Please, select your option : " ;
cin %26gt;%26gt; j;
switch(j)
{
case 1: cout %26lt;%26lt; "Enter the ammount to withdraw : ";
cin%26gt;%26gt; withdrawMoney;
nstr[0] -=withdrawMoney;
cout %26lt;%26lt; "\n your bank balance is now "
%26lt;%26lt;nstr[0] %26lt;%26lt; endl;break;
case 2: cout %26lt;%26lt; "Enter the ammount to deposit in account : ";
cin%26gt;%26gt; depositMoney;
nstr[0] += depositMoney;
cout %26lt;%26lt; "\n your bank balance is now "
%26lt;%26lt; nstr[0] %26lt;%26lt; endl;break;
case 0: cout %26lt;%26lt; " End of program. Thank you." %26lt;%26lt; endl;break;
C++ Bank Program?
Looks like a programming textbook example of an ATM user interface. It's not sufficiently comprehensive to use in real life, but it shows the outline structure of the code such that a trainee programmer could see what's going on. (However I'm a Forth programmer not C++, so I'm open to correction)
Reply:Looks like a menu
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment