include %26lt;iostream.h%26gt;
#include %26lt;stdexcept%26gt;
class Account
{
protected:
int answer;
public:
void display( int a);
};
class ATM : public Account
{
private:
double withdraw,deposit1,balance1;
public:
void withdrawal();
void deposit();
void balance();
};
Account::Account(int choice1)
{
if (choice1==1)
{
balance();
}
else if (choice1==2)
{ deposit();}
else if (choice1==3)
{withdrawal();}
else if (choice1==4)
cout %26lt;%26lt;"Quit" %26lt;%26lt;endl;
else
cout %26lt;%26lt;"Exit!" %26lt;%26lt;endl;
}
void Account::display(int a)
{
try
{
if(1234%26lt;a)
throw exception();
answer=a;
cout%26lt;%26lt;"Accept pin number";
cout%26lt;%26lt;"\n";
}
catch(exception %26amp;)
{
cout%26lt;%26lt;"Exception occured : Try again"%26lt;%26lt;endl;
}
}
void ATM :: withdrawal()
{
double withdraw;
balance1 = 1000;
cout %26lt;%26lt;"Enter amount of your withdrawal :RM " ;
cin %26gt;%26gt;withdraw;
balance1 = balance1 - withdraw;
cout %26lt;%26lt;"Your new balance is RM " %26lt;%26lt;balance1%26lt;%26lt;endl;
}
void ATM :: deposit()
{
withdrawal();
double deposit1;
cout %26lt;%26lt;"Enter amount of your deposit to other account :RM ";
cin %26gt;%26gt;deposit1;
balance1 = balance1 - deposit1;
cout %26lt;%26lt;"Your new balance is RM " %26lt;%26lt;balance1%26lt;%26lt;endl;
}
void ATM :: balance()
{
cout %26lt;%26lt;"The amount in your account is RM" %26lt;%26lt;balance1%26lt;%26lt;endl;
}
void main()
{int x, choice1;
cout%26lt;%26lt;"Enter your pin number : ";
cin%26gt;%26gt;x;
Account n;
n.display(x);
cout %26lt;%26lt;" **Maybank BANK BERHAD** " %26lt;%26lt;endl;
cout %26lt;%26lt;" **AUTOMATED TELLER MACHINE** " %26lt;%26lt;endl;
cout %26lt;%26lt;" Maybank Bank Berhad Main Menu " %26lt;%26lt;endl;
cout %26lt;%26lt;" 1. Balance Enquiry" %26lt;%26lt;endl;
cout %26lt;%26lt;" 2. Deposit" %26lt;%26lt;endl;
cout %26lt;%26lt;" 3. Withdrawal" %26lt;%26lt;endl;
cout %26lt;%26lt;" 4. Quit" %26lt;%26lt;endl;
cout%26lt;%26lt;"Enter your choise : ";
cin%26gt;%26gt;choice1;
choice();
ATM obj;
obj.deposit();
obj.balance();
}|||include %26lt;iostream.h%26gt;
First error there should be # in begining of first line.
#include %26lt;stdexcept%26gt; Next Error What this stdexcept ???
Is it headerfile??
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment