diff --git a/CPP b/CPP deleted file mode 100644 index b1d899f0540..00000000000 --- a/CPP +++ /dev/null @@ -1,199 +0,0 @@ - -#include -#include -using namespace std; - -#define MIN_BALANCE 500 - -class insufficientfunds -{ - -}; - -class account -{ - private: - long accountnumber; - string firstname; - string lastname; - float balance; - static long nextaccountnumber; - - public: - account(){} - - account(string fname,string lname,float balance) - { - firstname=fname; - lastname=lname; - balance=balance; - } - long getAccno() - { - return accountnumber; - } - string getfirstname() - { - return firstname; - } - string getlastname() - { - return lastname; - } - - float getbalance() - { - return balance; - } - - void deposit(float amount); - void withdraw(float amount); - static void setLastAccountNumber(long accountNumber); - static long getLastAccountNumber(); - friend ofstream & operator<<(ofstream &ofs,account &acc); - friend ifstream & operator>>(ifstream &ifs,account &acc); - friend ostream & operator>>(ostream &os,account &acc); - -}; - -long account::nextaccountnumber=0; - -class bank -{ - private: - map accounts; - - public: - bank(); - account openaccount(string fname,string lname,float balance); - account balanceenqiry(long accountnumber); - account deposit(long accountnumber,float amount); - account withdraw(long accountnumber,float amount); - void closeaccount(long accountnumber); - void showallaccount(); - ~bank(); -}; - -int main() -{ - bank b; - account acc; - - int choice; - string fname,lname; - long accountnumber; - float balance; - float amount; - cout<<"***banking system***"<>choice; - switch(choice) - { - case 1: - cout<<"Enter first name: "; - cin>>fname; - cout<<"Enter last name :"; - cin>>lname; - cout<<"Enter intial balance: "; - cin>>balance; - acc=b.openaccount(fname,lname,balance); - cout<>accountnumber; - acc=b.balanceenqiry(accountnumber); - cout<>accountnumber; - cout<<"Enter balance: "; - cin>>amount; - acc=b.deposit(accountnumber,amount); - cout<>accountnumber; - cout<<"Enter Balance: "; - cin>>amount; - acc=b.withdraw(accountnumber,amount); - cout<>accountnumber; - b.closeaccount(accountnumber); - cout<balance=balance; -} - -void account::deposit(float amount) -{ - balance+=amount; -} - -void account::withdraw(float amount) -{ - if(balance-amount