// Bank.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include<iostream> #include<cstring> using namespace std; class account { protected://get balance information for respective account type char c_Name[20]; long acc_Number; public: account(char *name,long num){strcpy_s(c_Name,name);acc_Number=num;} void display(){cout<<"Costumer name: "<<c_Name<<"\nAccount number: "<<acc_Number<<endl;} }; class saving : public account { protected: float balance,deposite,withdrawal; public: saving(char *name,long num): account(name,num){balance=0;deposite=0;withdrawal=0;} void saves () { int k; cout<<"To Deposte Enter ( 1 ) \t To Withdraw Enter ( 0 ): "; cin>>k; if(k) { cout<<"Enter the deposite amount: "; cin>>deposite; balance+=deposite; } else { cout<<"Enter the withdrawal amount: "; cin>>withdrawal; balance-=withdrawal; } cout<<"\nNew Balance : "<<balance<<endl; } }; class current : public saving { public: current(char *name,long num):saving(name,num){} void info(){cout<<"The last Deposite was: "<<deposite<<"\nThe last Withdrawal was: "<<withdrawal<<"\nYour Balance : "<<balance<<endl;}//last deposite & last withdrawal }; void main() { char n[20]; float b,d,w; int t; long acn; int choice=1; cout<<"Please enter your name: "; cin>>n; cout<<"Enter the account number: "; cin>>acn; current c(n,acn); while(choice != 0) { cout<<"\nEnter Your Choice:\n(1) for updating your account.\n(2) for showing Your Balance , the last deposite and withdrawal.\n(3) for displaying account information.\n(0) To EXIT !!!.\n==>"; cin>>choice; system("cls");//Instead of clrscr(); switch(choice) { case 0:goto END;break; case 1:c.saves();break; case 2:c.info();break; case 3:c.display();break; default:cout<<"Error!!";break; } } END:; }
الجمعة، 22 نوفمبر 2013
الاشتراك في:
تعليقات الرسالة (Atom)
0 التعليقات:
إرسال تعليق