See what you think and suggested improvements

This is a discussion on See what you think and suggested improvements within the C++ Programming forums, part of the General Programming Boards category; I wrote an banking system an just want to know what you experts think about it i hope you like ...

  1. #1
    Registered User
    Join Date
    Apr 2008
    Posts
    7

    See what you think and suggested improvements

    I wrote an banking system an just want to know what you experts think about it i hope you like it i have spent a lot of time on it. why not compile it yourself to see what you think?

    Code:
    #include <iostream>
    #include <algorithm>
    #include <vector>
    #include <fstream>
    #include <string>
    #include <sstream>
    #include <time.h>
    
    using namespace std;
    
    
    int mainmenu(int value1);
    int addmenu(int value2);
    int cardmenu(int value3);
    int adminmenu(int value4);
    
    class Customer
    {
    	public:
    			int  Customerid;
    			char FName[30];
    			char LName[30];
    			int  Age;
    			char Address1[100];						
    			char Postcode[30];
    			char Contact[10];
    		
    	public: 
    			Customer(int ptrCustomerid, char *ptrFName,char *ptrLName,int ptrAge,char *ptrAddress1,char *ptrAddress2,char *ptrPostcode,char *ptrContact)
    			{
    				Customerid = ptrCustomerid;
    				strcpy_s(FName,ptrFName);
    				strcpy_s(LName,ptrLName);
    				Age = ptrAge;
    				strcpy_s(Address1,ptrAddress1);
    				strcpy_s(Postcode,ptrPostcode);
    				strcpy_s(Contact,ptrContact);
    			}
    
    	void Display(void)
    			{
    				cout<<"Customer ID:  "<<Customerid<<endl;
    				cout<<"First Name:  "<<FName<<endl;
    				cout<<"Last	 Name:  "<<LName<<endl;
    				cout<<"Age:  "<<Age<<endl;
    				cout<<"Address 1:  "<<Address1<<endl;
    				cout<<"Postcode:  "<<Postcode<<endl;
    				cout<<"Contact Number:  "<<Contact<<endl;
    				cout<<"___________________________"<<endl;
    				cout<<"  "<<endl;
    			}
    	};
    
    
    
    class CurrentAccount
    {
    	public:
    			int  CurrentAccountid;
    			int  Customerid;
    			char CurrentAccount_open_date[100];					
    			char CurrentAccount_Last_date[100];			
    			int Balance;
    			int overdraft;
    	public: 
    			CurrentAccount(int ptrCurrentAccountid,int ptrCustomerid,char *ptrCurrentAccount_open_date,char *ptrCurrentAccount_Last_date,int ptrBalance)
    			{
    				CurrentAccountid = ptrCurrentAccountid;
    				Customerid = ptrCustomerid;
    				strcpy_s(CurrentAccount_open_date, ptrCurrentAccount_open_date);
    				strcpy_s(CurrentAccount_Last_date, ptrCurrentAccount_Last_date);
    				overdraft=300;
    				Balance = ptrBalance+overdraft;
    			}
    	void Display(void)
    			{
    				cout<<"Current Account Number:  "<<CurrentAccountid<<endl;
    				cout<<"Customer Number:  "<<Customerid<<endl;
    				cout<<"Current Account Opend ON:  "<<CurrentAccount_open_date<<endl;
    				cout<<"Last Transaction ON:  "<<CurrentAccount_Last_date<<endl;
    				cout<<"Balance:  "<<Balance<<endl;
    				cout<<"______________________________________________________________"<<endl;
    				cout<<"  "<<endl;
    			}
    	};
    class SavingAccount
    {
    	public:
    			int  SavingAccountid;
    			int  Customerid;
    			char SavingAccount_open_date[100];					
    			char SavingAccount_Last_date[100];			
    			int Balance;
    			int overdraft;
    	public: 
    			SavingAccount(int ptrSavingAccountid,int ptrCustomerid,char *ptrSavingAccount_open_date,char *ptrSavingAccount_Last_date,int ptrBalance)
    			{
    				SavingAccountid = ptrSavingAccountid;
    				Customerid = ptrCustomerid;
    				strcpy_s(SavingAccount_open_date, ptrSavingAccount_open_date);
    				strcpy_s(SavingAccount_Last_date, ptrSavingAccount_Last_date);
    				overdraft=1000;
    				Balance = ptrBalance+overdraft;
    			}
    	void Display(void)
    			{
    				cout<<"Saving Account Number:  "<<SavingAccountid<<endl;
    				cout<<"Customer Number:  "<<Customerid<<endl;
    				cout<<"Saving	Account Opend ON:  "<<SavingAccount_open_date<<endl;
    				cout<<"Last Transaction ON:  "<<SavingAccount_Last_date<<endl;
    				cout<<"Balance:  "<<Balance<<endl;
    				cout<<"______________________________________________________________"<<endl;
    				cout<<"  "<<endl;
    			}
    	};
    class CorporateSaving
    {
    	public:
    			int  CorporateSavingid;
    			int  Customerid;
    			char CorporateSaving_open_date[100];					
    			char CorporateSaving_Last_date[100];			
    			int Balance;
    			int overdraft;
    	public: 
    			CorporateSaving(int ptrCorporateSavingid,int ptrCustomerid,char *ptrCorporateSaving_open_date,char *ptrCorporateSaving_Last_date,int ptrBalance)
    			{
    				CorporateSavingid = ptrCorporateSavingid;
    				Customerid = ptrCustomerid;
    				strcpy_s(CorporateSaving_open_date, ptrCorporateSaving_open_date);
    				strcpy_s(CorporateSaving_Last_date, ptrCorporateSaving_Last_date);
    				overdraft=5000;
    				Balance = ptrBalance+overdraft;
    			}
    	void Display(void)
    			{
    				cout<<"Corporate Account Number:  "<<CorporateSavingid<<endl;
    				cout<<"Customer Number:  "<<Customerid<<endl;
    				cout<<"Corporate Saving Opend ON:  "<<CorporateSaving_open_date<<endl;
    				cout<<"Last Transaction ON:  "<<CorporateSaving_Last_date<<endl;
    				cout<<"Balance:  "<<Balance<<endl;
    				cout<<"______________________________________________________________"<<endl;
    				cout<<"  "<<endl;
    			}
    	};
    class StudentSaving
    {
    	public:
    			int  StudentSavingid;
    			int  Customerid;
    			char StudentSaving_open_date[100];					
    			char StudentSaving_Last_date[100];			
    			int Balance;
    			int overdraft;
    	public: 
    			StudentSaving(int ptrStudentSavingid,int ptrCustomerid,char *ptrStudentSaving_open_date,char *ptrStudentSaving_Last_date,int ptrBalance)
    			{
    				StudentSavingid = ptrStudentSavingid;
    				Customerid = ptrCustomerid;
    				strcpy_s(StudentSaving_open_date, ptrStudentSaving_open_date);
    				strcpy_s(StudentSaving_Last_date, ptrStudentSaving_Last_date);
    				overdraft=700;
    				Balance = ptrBalance+overdraft;
    			}
    	void Display(void)
    			{
    				cout<<"Student Account Number:  "<<StudentSavingid<<endl;
    				cout<<"Customer Number:  "<<Customerid<<endl;
    				cout<<"Student Saving Opend ON:  "<<StudentSaving_open_date<<endl;
    				cout<<"Last Transaction ON:  "<<StudentSaving_Last_date<<endl;
    				cout<<"Balance:  "<<Balance<<endl;
    				cout<<"______________________________________________________________"<<endl;
    				cout<<"  "<<endl;
    			}
    	};
    
    class PersonalLoan
    {
    	public:
    			int PersonalLoanid;
    			int  Customerid;
    			char PersonalLoan_open_date[100];					
    			char PersonalLoan_Last_date[100];			
    			int Balance;
    	public: 
    			PersonalLoan(int ptrPersonalLoanid, int ptrCustomerid, char *ptrPersonalLoan_open_date,char *ptrPersonalLoan_Last_date,int ptrBalance)
    			{
    				PersonalLoanid=ptrPersonalLoanid;
    				Customerid = ptrCustomerid;
    				strcpy_s(PersonalLoan_open_date, ptrPersonalLoan_open_date);
    				strcpy_s(PersonalLoan_Last_date, ptrPersonalLoan_Last_date);
    				Balance = ptrBalance;
    			}
    	void Display(void)
    			{
    				cout<<"Personal Loan Number			:  "<<PersonalLoanid<<endl;
    				cout<<"Customer Number				:  "<<Customerid<<endl;
    				cout<<"Personal Loaned On		    :  "<<PersonalLoan_open_date<<endl;
    				cout<<"Personal Loan End On			:  "<<PersonalLoan_Last_date<<endl;
    				cout<<"Personal Loan Ammount		:  "<<Balance<<endl;
    				cout<<"_________________________________________________"<<endl;
    				cout<<"  "<<endl;
    			}
    	};
    
    class CorporateLoan
    {
    	public:
    			int CorporateLoanid;
    			int  Customerid;
    			char CorporateLoan_open_date[100];					
    			char CorporateLoan_Last_date[100];			
    			int Balance;
    	public: 
    			CorporateLoan(int ptrCorporateLoanid, int ptrCustomerid, char *ptrCorporateLoan_open_date,char *ptrCorporateLoan_Last_date,int ptrBalance)
    			{
    				CorporateLoanid=ptrCorporateLoanid;
    				Customerid = ptrCustomerid;
    				strcpy_s(CorporateLoan_open_date, ptrCorporateLoan_open_date);
    				strcpy_s(CorporateLoan_Last_date, ptrCorporateLoan_Last_date);
    				Balance = ptrBalance;
    			}
    	void Display(void)
    			{
    				cout<<"Corporate Loan Number:  "<<CorporateLoanid<<endl;
    				cout<<"Customer Number:  "<<Customerid<<endl;
    				cout<<"Corporate Loaned On:  "<<CorporateLoan_open_date<<endl;
    				cout<<"Corporate Loan End On:  "<<CorporateLoan_Last_date<<endl;
    				cout<<"Corporate Loan Ammount:  "<<Balance<<endl;
    				cout<<"_________________________________________________"<<endl;
    				cout<<"  "<<endl;
    			}
    	};
    
    
    class Mortgage
    {
    	public:
    			int Mortgageid;
    			int  Customerid;
    			char Mortgage_open_date[100];					
    			char Mortgage_Last_date[100];			
    			int Balance;
    	public: 
    			Mortgage(int ptrMortgageid, int ptrCustomerid, char *ptrMortgage_open_date,char *ptrMortgage_Last_date,int ptrBalance)
    			{
    				Mortgageid=ptrMortgageid;
    				Customerid = ptrCustomerid;
    				strcpy_s(Mortgage_open_date, ptrMortgage_open_date);
    				strcpy_s(Mortgage_Last_date, ptrMortgage_Last_date);
    				Balance = ptrBalance;
    			}
    	void Display(void)
    			{
    				cout<<"Mortgage Loan Number			:  "<<Mortgageid<<endl;
    				cout<<"Customer Number				:  "<<Customerid<<endl;
    				cout<<"Mortgage Loaned On		    :  "<<Mortgage_open_date<<endl;
    				cout<<"Mortgage Loan End On			:  "<<Mortgage_Last_date<<endl;
    				cout<<"Mortgage Loan Ammount		:  "<<Balance<<endl;
    				cout<<"_________________________________________________"<<endl;
    				cout<<"  "<<endl;
    			}
    	};
    
    
    class CreditCard
    {
    	public:
    			int CreditCardid;
    			int Customerid;
    			int Accountid;
    			char CreditCard_open_date[100];					
    			char CreditCard_expire_date[100];			
    			int CreditCardNumber;
    			int CreditCardSecurityNumber;
    			int CreditCardPinNumber;
    			int SortCode;
    	public: 
    			CreditCard(int ptrCreditCardid, int ptrCustomerid, int ptrAccountid, char *ptrCreditCard_open_date,char *ptrCreditCard_expire_date,int ptrCreditCardNumber, int ptrCreditCardSecurityNumber, int ptrCreditCardPinNumber)
    			{
    				CreditCardid=ptrCreditCardid;
    				Customerid = ptrCustomerid;
    				Accountid = ptrAccountid;
    				strcpy_s(CreditCard_open_date, ptrCreditCard_open_date);
    				strcpy_s(CreditCard_expire_date, ptrCreditCard_expire_date);
    				CreditCardNumber = ptrCreditCardNumber;	
    				CreditCardSecurityNumber = ptrCreditCardSecurityNumber;
    				CreditCardPinNumber = ptrCreditCardPinNumber;
    				SortCode = 512178;
    			
    			}
    	void Display(void)
    			{
    				cout<<"Credit Card Number				:  "<<CreditCardNumber<<endl;
    				cout<<"Customer Number					:  "<<Customerid<<endl;
    				cout<<"Account Number					:  "<<Accountid<<endl;
    				cout<<"Credit Card Start Date		    :  "<<CreditCard_open_date<<endl;
    				cout<<"Credit Card Expiry Date			:  "<<CreditCard_expire_date<<endl;
    				cout<<"Credit Card Security Number		:  "<<CreditCardSecurityNumber<<endl;
    				cout<<"Credit Card Pin Number			:  "<<CreditCardPinNumber<<endl;
    				cout<<"Credit Card Sort Code			:  "<<SortCode<<endl;
    				cout<<"_________________________________________________"<<endl;
    				cout<<"  "<<endl;
    			}
    	};
    
    class DebitCard
    {
    	public:
    			int DebitCardid;
    			int Customerid;
    			int Accountid;
    			char DebitCard_open_date[100];					
    			char DebitCard_expire_date[100];			
    			int DebitCardNumber;
    			int DebitCardSecurityNumber;
    			int DebitCardPinNumber;
    			int SortCode;
    	public: 
    			DebitCard(int ptrDebitCardid, int ptrCustomerid, int ptrAccountid, char *ptrDebitCard_open_date,char *ptrDebitCard_expire_date,int ptrDebitCardNumber, int ptrDebitCardSecurityNumber, int ptrDebitCardPinNumber)
    			{
    				DebitCardid=ptrDebitCardid;
    				Customerid = ptrCustomerid;
    				Accountid = ptrAccountid;
    				strcpy_s(DebitCard_open_date, ptrDebitCard_open_date);
    				strcpy_s(DebitCard_expire_date, ptrDebitCard_expire_date);
    				DebitCardNumber = ptrDebitCardNumber;	
    				DebitCardSecurityNumber = ptrDebitCardSecurityNumber;
    				DebitCardPinNumber = ptrDebitCardPinNumber;
    				SortCode = 512178;
    			
    			}
    	void Display(void)
    			{
    				cout<<"Debit Card Number:  "<<DebitCardNumber<<endl;
    				cout<<"Customer Number:  "<<Customerid<<endl;
    				cout<<"Account Number:  "<<Accountid<<endl;
    				cout<<"Debit Card Start Date:  "<<DebitCard_open_date<<endl;
    				cout<<"Debit Card Expiry Date:  "<<DebitCard_expire_date<<endl;
    				cout<<"Debit Card Security Number:  "<<DebitCardSecurityNumber<<endl;
    				cout<<"Debit Card Pin Number:  "<<DebitCardPinNumber<<endl;
    				cout<<"Debit Card Sort Code:  "<<SortCode<<endl;
    				cout<<"_________________________________________________"<<endl;
    				cout<<"  "<<endl;
    			}
    	};
    
    
    class Cheque
    {
    	public:
    			int Chequeid;
    			int Customerid;
    			int Accountid;	
    			int SortCode;
    	public: 
    			Cheque(int ptrChequeid, int ptrCustomerid, int ptrAccountid)
    			{
    				Chequeid=ptrChequeid;
    				Customerid = ptrCustomerid;
    				Accountid = ptrAccountid;
    				SortCode = 512178;
    			
    			}
    	void Display(void)
    			{
    				cout<<"Cheque Card Number:  "<<Chequeid<<endl;
    				cout<<"Customer Number:  "<<Customerid<<endl;
    				cout<<"Account Number:  "<<Accountid<<endl;
    				cout<<"Cheque Card Sort Code:  "<<SortCode<<endl;
    				cout<<"_________________________________________________"<<endl;
    				cout<<"  "<<endl;
    			}
    	};
    int mainmenu(int value1)
    {
    
    		cout<<"------- Select Menu -------"<<endl;
    		cout<<"1     Add Customer"<<endl;
    		cout<<"2     Delete Customer"<<endl;
    		cout<<"3     Add Account"<<endl;
    		cout<<"4     Delete Account"<<endl;
    		cout<<"5     Transaction(-)"<<endl;
    		cout<<"6     Transaction(+)"<<endl;
    		cout<<"7     Admin Menu"<<endl;
    		cout<<"8     Exit"<<endl;
    		cout<<""<<endl;
    		cout<<"-----------------------------"<<endl;
    		cout<<"Please Select An Option......"<<endl;
    		cout<<""<<endl;
    
    		int o;
    		cin>>o;
    		cout<<""<<endl;
    		value1 = o;
    		return value1;
    
    }
    int addmenu(int value2)
    {
    
    		cout<<"------- Select Account -------"<<endl;
    		cout<<"1      Current Account"<<endl;
    		cout<<"2      Savings Account"<<endl;
    		cout<<"3      CorporateSaving"<<endl;
    		cout<<"4      StudentSaving"<<endl;
    		cout<<"5      Corporate Loan"<<endl;
    		cout<<"6      Personal Loan"<<endl;
    		cout<<"7      Mortgage"<<endl;
    		cout<<""<<endl;
    		cout<<"-----------------------------"<<endl;
    		cout<<"Please Select An Option......"<<endl;
    		cout<<""<<endl;
    
    		int o;
    		cin>>o;
    		cout<<""<<endl;
    		value2 = o;
    		return value2;
    
    }
    int cardmenu(int value3)
    {
    
    		cout<<"------- Select Cards -------"<<endl;
    		cout<<"1      Debit Card"<<endl;
    		cout<<"2      Credit Card"<<endl;
    		cout<<"3      Cheque"<<endl;
    		cout<<""<<endl;
    		cout<<"-----------------------------"<<endl;
    		cout<<"Please Select An Option......"<<endl;
    		cout<<""<<endl;
    
    		int o;
    		cin>>o;
    		cout<<""<<endl;
    		value3 = o;
    		return value3;
    
    }
    int adminmenu(int value4)
    {
    
    		cout<<"------- Select Menu -------"<<endl;
    		cout<<"1      Customer Details"<<endl;
    		cout<<"2      Exit"<<endl;
    		cout<<""<<endl;
    		cout<<"-----------------------------"<<endl;
    		cout<<"Please Select An Option......"<<endl;
    		cout<<""<<endl;
    
    		int o;
    		cin>>o;
    		cout<<""<<endl;
    		value4 = o;
    		return value4;
    
    }
    
    int main(void)
    {
    	int customerid = 1000;
    	int accountid = 2000;
    	int cardid = 3000;
    	int cardcumber= 0;
    	int cardsecuritynumber=100;
    	int cardpinnumber=1234;
    	int select1, select2;
    	char date [10];
    	_strdate_s(date);
    	char finalenddate[10]="10/2012";
     	vector<Customer*>customer1;
     	vector<CurrentAccount*>currentaccount1;
     	vector<SavingAccount*>savingaccount1;
     	vector<CorporateSaving*>corporatesaving1;
     	vector<StudentSaving*>studentsaving1;
    	vector<CorporateLoan*>corporateloan1;
     	vector<PersonalLoan*>personalloan1;
    	vector<Mortgage*>mortgage1;
    	vector<DebitCard*>debitcard1;
     	vector<CreditCard*>creditcard1;
    	vector<Cheque*>cheque1;
    	do
    	{
    		select1=0;
    		select2 = 0;
    		select2 = mainmenu(select1); 
    		switch (select2)
    		{
    			case 1:
    			{
    					vector <Customer> customer;
    					int num ;
    					cout<<"Enter Number of customers you wish to do data for:	  ";
    					cin >> num;
    					cout<<""<<endl;
    					int k = 0;
    					do
    					{
    						customerid++;
    						accountid++;
    						cardcumber++;
    						cardsecuritynumber++;
    						cardpinnumber++;
    						cardid++;		
    						
    						char fname[30];
    						char lname[30];
    						int age;
    						char address1[100];
    						char postcode[100];						
    						int contact;
    					
    						cout<<"Enter First Name:	";
    						cin>>fname;
    						cout<<"Enter Last Name:	";
    						cin>>lname;
    						cout<<"Enter Age: ";
    						cin>>age;
    						cout<<"Enter Address 1:	";
    						cin>>address1;
    						cout<<"Enter Postcode:	";
    						cin>>postcode;
    						cout<<"Enter Contact: ";
    						cin>>contact;
    						cout<<""<<endl;
    			
    						int select3, select4;
    						do
    						{
    
    							select3 =0;
    							select4 = addmenu(select3); 
    							switch (select4)
    							{
    								case 1:
    								{
    									int balance;
    									char lastTran[100]="--------";						
    									cout<<"Enter Balance	:	";
    									cin>>balance;
    									cout<<""<<endl;
    									char *b1=date;
    									char *b2=lastTran;
    									CurrentAccount* obj1 = new CurrentAccount(accountid,customerid, b1,b2,balance);
    									currentaccount1.push_back(obj1);
    									obj1=NULL;					
    								}
    								break;
    								case 2:
    								{
    									int balance;
    									char lastTran[100]="--------";						
    									cout<<"Enter Balance	:	";
    									cin>>balance;
    									cout<<""<<endl;
    									char *b1=date;
    									char *b2=lastTran;
    									SavingAccount* obj1 = new SavingAccount(accountid,customerid, b1,b2,balance);
    									savingaccount1.push_back(obj1);
    									obj1=NULL;
    								}
    								break;
    								case 3:
    								{
    									int balance;
    									char lastTran[100]="--------";						
    									cout<<"Enter Balance	:	";
    									cin>>balance;
    									cout<<""<<endl;
    									char *b1=date;
    									char *b2=lastTran;
    									CorporateSaving* obj1 = new CorporateSaving(accountid,customerid, b1,b2,balance);
    									corporatesaving1.push_back(obj1);
    									obj1=NULL;								
    								}
    								break;
    								case 4:
    								{
    									int balance;
    									char lastTran[100]="--------";						
    									cout<<"Enter Balance	:	";
    									cin>>balance;
    									cout<<""<<endl;
    									char *b1=date;
    									char *b2=lastTran;
    									StudentSaving* obj1 = new StudentSaving(accountid,customerid, b1,b2,balance);
    									studentsaving1.push_back(obj1);
    									obj1=NULL;
    								}
    								break;
    								case 5:
    								{
    									int creditlimit;
    									cout<<"Enter creditlimit	:";
    									cin>>creditlimit;
    									if(creditlimit>100)
    									{
    										int balance;
    										char lastTran[100]="--------";						
    										cout<<"Enter Loan Amount	:	";
    										cin>>balance;
    										cout<<""<<endl;
    										char *b1=date;
    										char *b2=lastTran;
    										CorporateLoan* obj1 = new CorporateLoan(accountid,customerid, b1,b2,balance);
    										corporateloan1.push_back(obj1);
    										obj1=NULL;
    									}
    									else
    									{
    										cout<<"Sorry Credit Limit is less"<<endl;
    										select4=20;
    									}
    								}
    								break;
    								case 6:
    								{
    									int creditlimit;
    									cout<<"Enter creditlimit	:";
    									cin>>creditlimit;
    									if(creditlimit>50)
    									{
    									
    									int balance;
    									char lastTran[100]="--------";						
    									cout<<"Enter Loan Amount	:	";
    									cin>>balance;
    									cout<<""<<endl;
    									char *b1=date;
    									char *b2=lastTran;
    									PersonalLoan* obj1 = new PersonalLoan(accountid,customerid, b1,b2,balance);
    									personalloan1.push_back(obj1);
    									obj1=NULL;
    									}
    									else
    									{
    										cout<<"Sorry Credit Limit is less"<<endl;
    										select4=20;
    									}
    								}
    								break;
    								case 7:
    								{
    									int creditlimit;
    									cout<<"Enter creditlimit	:";
    									cin>>creditlimit;
    									if(creditlimit>75)
    									{
    									
    									int balance;
    									char lastTran[100]="--------";						
    									cout<<"Enter Mortgage	:	";
    									cin>>balance;
    									cout<<""<<endl;
    									int mgo2=80/100*balance;
    									balance=mgo2;
    									char *b1=date;
    									char *b2=lastTran;
    									Mortgage* obj1 = new Mortgage(accountid,customerid, b1,b2,balance);
    									mortgage1.push_back(obj1);
    									obj1=NULL;				
    									}
    									else
    									{
    										cout<<"Sorry Credit Limit is less"<<endl;
    										select4=20;
    									}
    								}
    								break;
    							}
    						}
    						while(select4!=1&&select4!=2&&select4!=2&&select4!=3&&select4!=4&&select4!=5&&select4!=6&&select4!=7);
    						if(select4==1||select4==2||select4==3||select4==4)
    						{
    						int select5 =0; 
    						int select6 =0;
    						do
    						{
    							select6 = cardmenu(select5); 
    							switch (select6)
    							{
    								case 1:
    								{
    									char *c1=date;
    									char *c2=finalenddate;								
    									DebitCard* obj1 = new DebitCard(cardid,customerid,accountid,c1,c2,cardcumber,cardsecuritynumber,cardpinnumber);
    									debitcard1.push_back(obj1);
    									obj1=NULL;
    								}
    								break;
    								case 2:
    								{
    									char *c1=date;
    									char *c2=finalenddate;								
    									CreditCard* obj1 = new CreditCard(cardid,customerid,accountid,c1,c2,cardcumber,cardsecuritynumber,cardpinnumber);
    									creditcard1.push_back(obj1);
    									obj1=NULL;				
    								}
    								break;
    								case 3:
    								{
    									Cheque* obj1 = new Cheque(cardid,customerid,accountid);
    									cheque1.push_back(obj1);
    									obj1=NULL;		
    								}
    								break;
    							}
    						}
    						while(select6!=1&&select6!=2&&select6!=3);
    						}
    						k++;
    					}
    					while(k != num);			
    			}
    			break;
    
    			case 2:
    			{
    				int delcustomerid;
    				cout<<"Customer ID Full Name "<<endl;
    				for(int x =0; x << customer1.size(); x++)
    				{
    					cout<<customer1[x]->Customerid<<"		"<<customer1[x]->FName<<"		"<<customer1[x]->LName<<endl;	
    				}			
    				if(customer1.size()==0)
    				{
    				}
    				else
    				{
    				cout<<"Please enter a customer id........"<<endl;
    				cin>>delcustomerid;
    				for(int x =0; x == customer1.size(); x++)
    				{
    					if(customer1[x]->Customerid==delcustomerid)
    					{
    						customer1.erase(customer1.begin()+x,customer1.begin()+1+x);
    						x=0;
    					}
    				}
    				for(int x =0; x==currentaccount1.size(); x++)
    				{
    					if(currentaccount1[x]->Customerid==delcustomerid)
    					{
    						currentaccount1.erase(currentaccount1.begin()+x,currentaccount1.begin()+1+x);
    						x=0;
    					}
    				}
    				for(int x =0; x==savingaccount1.size(); x++)
    				{
    					if(savingaccount1[x]->Customerid==delcustomerid)
    					{
    						savingaccount1.erase(savingaccount1.begin()+x,savingaccount1.begin()+1+x);
    						x=0;
    					}
    				}
    				for(int x =0; x==corporatesaving1.size(); x++)
    				{
    					if(corporatesaving1[x]->Customerid==delcustomerid)
    					{
    						corporatesaving1.erase(corporatesaving1.begin()+x,corporatesaving1.begin()+1+x);
    						x=0;
    					}
    				}
    				for(int x =0; x==studentsaving1.size(); x++)
    				{
    					if(studentsaving1[x]->Customerid==delcustomerid)
    					{
    						studentsaving1.erase(studentsaving1.begin()+x,studentsaving1.begin()+1+x);
    						x=0;
    					}
    				}
    				for(int x =0; x==corporateloan1.size(); x++)
    				{
    					if(corporateloan1[x]->Customerid==delcustomerid)
    					{
    						corporateloan1.erase(corporateloan1.begin()+x,corporateloan1.begin()+1+x);
    						x=0;
    					}
    				}
    				for(int x =0; x==personalloan1.size(); x++)
    				{
    					if(personalloan1[x]->Customerid==delcustomerid)
    					{
    						personalloan1.erase(personalloan1.begin()+x,personalloan1.begin()+1+x);
    						x=0;
    					}
    				}
    				for(int x =0; x==mortgage1.size(); x++)
    				{
    					if(mortgage1[x]->Customerid==delcustomerid)
    					{
    						mortgage1.erase(mortgage1.begin()+x,mortgage1.begin()+1+x);
    						x=0;
    					}
    				}
    				for(int x =0; x==debitcard1.size(); x++)
    				{
    					if(debitcard1[x]->Customerid==delcustomerid)
    					{
    						debitcard1.erase(debitcard1.begin()+x,debitcard1.begin()+1+x);
    						x=0;
    					}
    				}
    				for(int x =0; x==creditcard1.size(); x++)
    				{
    					if(creditcard1[x]->Customerid==delcustomerid)
    					{
    						creditcard1.erase(creditcard1.begin()+x,creditcard1.begin()+1+x);
    						x=0;
    					}
    				}
    				for(int x =0; x==cheque1.size(); x++)
    				{
    					if(cheque1[x]->Customerid==delcustomerid)
    					{
    						cheque1.erase(cheque1.begin()+x,cheque1.begin()+1+x);
    						x=0;
    					}
    				}
    			}
    				
    
    			}
    			break;
    			case 3:
    			{	cout<<"Customerid	Full Name "<<endl;	
    								
    				for(int x =0; x==customer1.size(); x++)
    				{
    					cout<<customer1[x]->Customerid<<" "<<customer1[x]->FName<<" "<<customer1[x]->LName<<endl;	
    				}			
    				if(customer1.size()==0)
    				{
    				}
    				else
    				{
    				
    				int customerid2;
    				cout<<"Enter customer number........"<<endl;
    				cin>>customerid2;
    				
    				int select3, select4;
    				accountid++;
    				cardcumber++;
    				cardsecuritynumber++;
    				cardpinnumber++;
    				cardid++;	
    						do
    						{
    							select3 =0;
    							select4 = addmenu(select3); 
    							switch (select4)
    							{
    								case 1:
    								{
    									int balance;
    									char lastTran[100]="--------";						
    									cout<<"Enter Balance	:	";
    									cin>>balance;
    									cout<<""<<endl;
    									char *b1=date;
    									char *b2=lastTran;
    									CurrentAccount* obj1 = new CurrentAccount(accountid,customerid2, b1,b2,balance);
    									currentaccount1.push_back(obj1);
    									obj1=NULL;					
    								}
    								break;
    								case 2:
    								{
    									int balance;
    									char lastTran[100]="--------";						
    									cout<<"Enter Balance	:	";
    									cin>>balance;
    									cout<<""<<endl;
    									char *b1=date;
    									char *b2=lastTran;
    									SavingAccount* obj1 = new SavingAccount(accountid,customerid2, b1,b2,balance);
    									savingaccount1.push_back(obj1);
    									obj1=NULL;
    								}
    								break;
    								case 3:
    								{
    									int balance;
    									char lastTran[100]="--------";						
    									cout<<"Enter Balance	:	";
    									cin>>balance;
    									cout<<""<<endl;
    									char *b1=date;
    									char *b2=lastTran;
    									CorporateSaving* obj1 = new CorporateSaving(accountid,customerid2, b1,b2,balance);
    									corporatesaving1.push_back(obj1);
    									obj1=NULL;								
    								}
    								break;
    								case 4:
    								{
    									int balance;
    									char lastTran[100]="--------";						
    									cout<<"Enter Balance	:	";
    									cin>>balance;
    									cout<<""<<endl;
    									char *b1=date;
    									char *b2=lastTran;
    									StudentSaving* obj1 = new StudentSaving(accountid,customerid2, b1,b2,balance);
    									studentsaving1.push_back(obj1);
    									obj1=NULL;
    								}
    								break;
    								case 5:
    								{
    									int creditlimit;
    									cout<<"Enter creditlimit	:";
    									cin>>creditlimit;
    									if(creditlimit>100)
    									{
    										int balance;
    										char lastTran[100]="--------";						
    										cout<<"Enter Loan Amount	:	";
    										cin>>balance;
    										cout<<""<<endl;
    										char *b1=date;
    										char *b2=lastTran;
    										CorporateLoan* obj1 = new CorporateLoan(accountid,customerid2, b1,b2,balance);
    										corporateloan1.push_back(obj1);
    										obj1=NULL;
    									}
    									else
    									{
    										cout<<"Sorry Credit Limit is less"<<endl;
    										select4=20;
    									}
    								}
    								break;
    								case 6:
    								{
    									int creditlimit;
    									cout<<"Enter creditlimit	:";
    									cin>>creditlimit;
    									if(creditlimit>50)
    									{
    									
    									int balance;
    									char lastTran[100]="--------";						
    									cout<<"Enter Loan Amount	:	";
    									cin>>balance;
    									cout<<""<<endl;
    									char *b1=date;
    									char *b2=lastTran;
    									PersonalLoan* obj1 = new PersonalLoan(accountid,customerid2, b1,b2,balance);
    									personalloan1.push_back(obj1);
    									obj1=NULL;
    									}
    									else
    									{
    										cout<<"Sorry Credit Limit is less"<<endl;
    										select4=20;
    									}
    								}
    								break;
    								case 7:
    								{
    									int creditlimit;
    									cout<<"Enter creditlimit	:";
    									cin>>creditlimit;
    									if(creditlimit>75)
    									{
    									
    									int balance;
    									char lastTran[100]="--------";						
    									cout<<"Enter Mortgage Amount	:	";
    									cin>>balance;
    									int mgo=80/100*balance;
    									balance=mgo;
    									cout<<""<<endl;
    									char *b1=date;
    									char *b2=lastTran;
    									Mortgage* obj1 = new Mortgage(accountid,customerid2, b1,b2,balance);
    									mortgage1.push_back(obj1);
    									obj1=NULL;				
    									}
    									else
    									{
    										cout<<"Sorry Credit Limit is less"<<endl;
    										select4=20;
    									}
    								}
    								break;
    							}
    						}
    						while(select4!=1&&select4!=2&&select4!=2&&select4!=3&&select4!=4&&select4!=5&&select4!=6&&select4!=7);
    						if(select4==1||select4==2||select4==3||select4==4)
    						{
    						int select5, select6;
    						do
    						{
    							select5 =0;
    							select6 = cardmenu(select5); 
    							switch (select6)
    							{
    								case 1:
    								{
    									char *c1=date;
    									char *c2=finalenddate;								
    									DebitCard* obj1 = new DebitCard(cardid,customerid2,accountid,c1,c2,cardcumber,cardsecuritynumber,cardpinnumber);
    									debitcard1.push_back(obj1);
    									obj1=NULL;
    								}
    								break;
    								case 2:
    								{
    									char *c1=date;
    									char *c2=finalenddate;								
    									CreditCard* obj1 = new CreditCard(cardid,customerid2,accountid,c1,c2,cardcumber,cardsecuritynumber,cardpinnumber);
    									creditcard1.push_back(obj1);
    									obj1=NULL;				
    								}
    								break;
    								case 3:
    								{
    									Cheque* obj1 = new Cheque(cardid,customerid2,accountid);
    									cheque1.push_back(obj1);
    									obj1=NULL;		
    								}
    								break;
    							}
    						}
    						while(select6!=1&&select6!=2&&select6!=3);
    						}
    				
    			}
    			}
    			break;			
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////			
    			case 4:
    			{
    				int delcustomerid;
    				int y =0;
    				cout<<"Customerid	Accountid	Type"<<endl;	
    								
    				for(int x =0; x==currentaccount1.size(); x++, y++)
    				{
    					cout<<currentaccount1[x]->Customerid<<"	"<<currentaccount1[x]->CurrentAccountid<<"Current Account"<<endl;	
    				}
    
    				for(int x =0; x==savingaccount1.size(); x++,y++)
    				{
    					cout<<savingaccount1[x]->Customerid<<"		"<<savingaccount1[x]->SavingAccountid<<"Saving Account"<<endl;	
    				}
    
    				for(int x =0; x==corporatesaving1.size(); x++,y++)
    				{
    					cout<<corporatesaving1[x]->Customerid<<" "<<corporatesaving1[x]->CorporateSavingid<<"Corporate Saving"<<endl;	
    				}
    				for(int x =0; x==studentsaving1.size(); x++,y++)
    				{
    					cout<<studentsaving1[x]->Customerid<<"	"<<studentsaving1[x]->StudentSavingid<<"Student Saving"<<endl;	
    				}
    				for(int x =0; x==personalloan1.size(); x++,y++)
    				{
    					cout<<personalloan1[x]->Customerid<<" "<<personalloan1[x]->PersonalLoanid<<"Personal Loan"<<endl;	
    				}
    				for(int x =0; x==corporateloan1.size(); x++,y++)
    				{
    					cout<<corporateloan1[x]->Customerid<<"	"<<corporateloan1[x]->CorporateLoanid<<"Corporate Loan"<<endl;	
    				}
    				for(int x =0; x==mortgage1.size(); x++,y++)
    				{
    					cout<<mortgage1[x]->Customerid<<" "<<mortgage1[x]->Mortgageid<<"Mortgage"<<endl;	
    				}
    								if(y==0)
    				{
    				}
    				else
    				{
    				cout<<"Please enter a account id........"<<endl;
    				cin>>delcustomerid;
    
    				for(int x =0; x==currentaccount1.size(); x++)
    				{
    					if(currentaccount1[x]->CurrentAccountid==delcustomerid)
    					{
    						currentaccount1.erase(currentaccount1.begin()+x,currentaccount1.begin()+1+x);
    						x=0;
    					}
    				}
    				for(int x =0; x==savingaccount1.size(); x++)
    				{
    					if(savingaccount1[x]->SavingAccountid==delcustomerid)
    					{
    						savingaccount1.erase(savingaccount1.begin()+x,savingaccount1.begin()+1+x);
    						x=0;
    					}
    				}
    				for(int x =0; x==corporatesaving1.size(); x++)
    				{
    					if(corporatesaving1[x]->CorporateSavingid==delcustomerid)
    					{
    						corporatesaving1.erase(corporatesaving1.begin()+x,corporatesaving1.begin()+1+x);
    						x=0;
    					}
    				}
    				for(int x =0; x==studentsaving1.size(); x++)
    				{
    					if(studentsaving1[x]->StudentSavingid==delcustomerid)
    					{
    						studentsaving1.erase(studentsaving1.begin()+x,studentsaving1.begin()+1+x);
    						x=0;
    					}
    				}
    				for(int x =0; x==corporateloan1.size(); x++)
    				{
    					if(corporateloan1[x]->CorporateLoanid==delcustomerid)
    					{
    						corporateloan1.erase(corporateloan1.begin()+x,corporateloan1.begin()+1+x);
    						x=0;
    					}
    				}
    				for(int x =0; x==personalloan1.size(); x++)
    				{
    					if(personalloan1[x]->PersonalLoanid==delcustomerid)
    					{
    						personalloan1.erase(personalloan1.begin()+x,personalloan1.begin()+1+x);
    						x=0;
    					}
    				}
    				for(int x =0; x==mortgage1.size(); x++)
    				{
    					if(mortgage1[x]->Mortgageid==delcustomerid)
    					{
    						mortgage1.erase(mortgage1.begin()+x,mortgage1.begin()+1+x);
    						x=0;
    					}
    				}
    				for(int x =0; x==debitcard1.size(); x++)
    				{
    					if(debitcard1[x]->Accountid==delcustomerid)
    					{
    						debitcard1.erase(debitcard1.begin()+x,debitcard1.begin()+1+x);
    						x=0;
    					}
    				}
    				for(int x =0; x==creditcard1.size(); x++)
    				{
    					if(creditcard1[x]->Accountid==delcustomerid)
    					{
    						creditcard1.erase(creditcard1.begin()+x,creditcard1.begin()+1+x);
    						x=0;
    					}
    				}
    				for(int x =0; x==cheque1.size(); x++)
    				{
    					if(cheque1[x]->Accountid==delcustomerid)
    					{
    						cheque1.erase(cheque1.begin()+x,cheque1.begin()+1+x);
    						x=0;
    					}
    				}
    			  }
    			}
    			break;
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    			case 5:
    			{
    				int delcustomerid;
    				int acctype;
    				int y =0;
    				cout<<"Customerid		Accountid		Type"<<endl;	
    								
    				for(int x =0; x==currentaccount1.size(); x++, y++)
    				{
    					cout<<"1 "<<currentaccount1[x]->Customerid<<" "<<currentaccount1[x]->CurrentAccountid<<"Current Account"<<endl;	
    				}
    
    				for(int x =0; x==savingaccount1.size(); x++,y++)
    				{
    					cout<<"2 "<<savingaccount1[x]->Customerid<<" "<<savingaccount1[x]->SavingAccountid<<"Saving Account"<<endl;	
    				}
    
    				for(int x =0; x==corporatesaving1.size(); x++,y++)
    				{
    					cout<<"3 "<<corporatesaving1[x]->Customerid<<" "<<corporatesaving1[x]->CorporateSavingid<<"Corporate Saving"<<endl;	
    				}
    				for(int x =0; x==studentsaving1.size(); x++,y++)
    				{
    					cout<<"4 "<<studentsaving1[x]->Customerid<<" "<<studentsaving1[x]->StudentSavingid<<"Student Saving"<<endl;	
    				}
    				for(int x =0; x == personalloan1.size(); x++,y++)
    				{
    					cout<<"5 "<<personalloan1[x]->Customerid<<"	"<<personalloan1[x]->PersonalLoanid<<"Personal Loan"<<endl;	
    				}
    				for(int x =0; x==corporateloan1.size(); x++,y++)
    				{
    					cout<<"6 "<<corporateloan1[x]->Customerid<<" "<<corporateloan1[x]->CorporateLoanid<<"Corporate Loan"<<endl;	
    				}
    				for(int x =0; x==mortgage1.size(); x++,y++)
    				{
    					cout<<"7 "<<mortgage1[x]->Customerid<<"	"<<mortgage1[x]->Mortgageid<<"Mortgage"<<endl;	
    				}
    				if(y==0)
    				{
    				}
    				else
    				{
    				cout<<"Please enter a account type........"<<endl;
    				cin>>acctype;
    
    				cout<<"Please enter a account id........"<<endl;
    				cin>>delcustomerid;
    				if(acctype==1)
    				{
    					int amt;
    					for(int x =0; x==currentaccount1.size(); x++)
    					{
    						if(currentaccount1[x]->CurrentAccountid==delcustomerid)
    						{
    							cout<<"Account Number	:"<<delcustomerid<<endl;
    							cout<<"Balance			:"<<currentaccount1[x]->Balance-currentaccount1[x]->overdraft<<endl;
    							cout<<"Overdraft		:"<<currentaccount1[x]->overdraft<<endl;
    							cout<<"-----------------------------------------"<<endl;
    							cout<<"Available		:"<<currentaccount1[x]->Balance<<endl;
    							cout<<"Please enter the ammount you want to withdraw............."<<endl;
    							cin>>amt;
    							if(amt>currentaccount1[x]->Balance)
    							{
    								cout<<"Sorry amount is more than what you have"<<endl;
    								
    							}
    							else
    							{
    								currentaccount1[x]->Balance=(currentaccount1[x]->Balance-amt);
    								cout<<"Account Number	:"<<delcustomerid<<endl;
    								cout<<"Balance			:"<<currentaccount1[x]->Balance-currentaccount1[x]->overdraft<<endl;
    								cout<<"Overdraft		:"<<currentaccount1[x]->overdraft<<endl;
    								cout<<"-----------------------------------------"<<endl;
    								cout<<"Available		:"<<currentaccount1[x]->Balance<<endl;
    
    							}
    							
    						}
    					}
    				}
    								if(acctype==2)
    				{
    					int amt;
    					for(int x =0; x == savingaccount1.size(); x++)
    					{
    						if(savingaccount1[x]->SavingAccountid==delcustomerid)
    						{
    							cout<<"Account Number	:"<<delcustomerid<<endl;
    							cout<<"Balance			:"<<savingaccount1[x]->Balance-savingaccount1[x]->overdraft<<endl;
    							cout<<"Overdraft		:"<<savingaccount1[x]->overdraft<<endl;
    							cout<<"-----------------------------------------"<<endl;
    							cout<<"Available		:"<<savingaccount1[x]->Balance<<endl;
    							cout<<"Please enter the ammount you want to withdraw............."<<endl;
    							cin>>amt;
    							if(amt>savingaccount1[x]->Balance)
    							{
    								cout<<"Sorry amount is more than what you have"<<endl;
    								
    							}
    							else
    							{
    								savingaccount1[x]->Balance=(savingaccount1[x]->Balance-amt);
    								cout<<"Account Number	:"<<delcustomerid<<endl;
    								cout<<"Balance			:"<<savingaccount1[x]->Balance-savingaccount1[x]->overdraft<<endl;
    								cout<<"Overdraft		:"<<savingaccount1[x]->overdraft<<endl;
    								cout<<"-----------------------------------------"<<endl;
    								cout<<"Available		:"<<savingaccount1[x]->Balance<<endl;
    
    							}
    							
    						}
    					}
    				}
    if(acctype==3)
    				{
    					int amt;
    					for(int x =0; x==corporatesaving1.size(); x++)
    					{
    						if(corporatesaving1[x]->CorporateSavingid==delcustomerid)
    						{
    							cout<<"Account Number	:"<<delcustomerid<<endl;
    							cout<<"Balance			:"<<corporatesaving1[x]->Balance-corporatesaving1[x]->overdraft<<endl;
    							cout<<"Overdraft		:"<<corporatesaving1[x]->overdraft<<endl;
    							cout<<"-----------------------------------------"<<endl;
    							cout<<"Available		:"<<corporatesaving1[x]->Balance<<endl;
    							cout<<"Please enter the ammount you want to withdraw............."<<endl;
    							cin>>amt;
    							if(amt>corporatesaving1[x]->Balance)
    							{
    								cout<<"Sorry amount is more than what you have"<<endl;
    								
    							}
    							else
    							{
    								corporatesaving1[x]->Balance=(corporatesaving1[x]->Balance-amt);
    								cout<<"Account Number	:"<<delcustomerid<<endl;
    								cout<<"Balance			:"<<corporatesaving1[x]->Balance-corporatesaving1[x]->overdraft<<endl;
    								cout<<"Overdraft		:"<<corporatesaving1[x]->overdraft<<endl;
    								cout<<"-----------------------------------------"<<endl;
    								cout<<"Available		:"<<corporatesaving1[x]->Balance<<endl;
    
    							}
    							
    						}
    					}
    				}
    
    
    				if(acctype==4)
    				{
    					int amt;
    					for(int x =0; x==studentsaving1.size(); x++)
    					{
    						if(studentsaving1[x]->StudentSavingid==delcustomerid)
    						{
    							cout<<"Account Number	:"<<delcustomerid<<endl;
    							cout<<"Balance			:"<<studentsaving1[x]->Balance-studentsaving1[x]->overdraft<<endl;
    							cout<<"Overdraft		:"<<studentsaving1[x]->overdraft<<endl;
    							cout<<"-----------------------------------------"<<endl;
    							cout<<"Available		:"<<studentsaving1[x]->Balance<<endl;
    							cout<<"Please enter the ammount you want to withdraw............."<<endl;
    							cin>>amt;
    							if(amt>studentsaving1[x]->Balance)
    							{
    								cout<<"Sorry amount is more than what you have"<<endl;
    								
    							}
    							else
    							{
    								studentsaving1[x]->Balance=(studentsaving1[x]->Balance-amt);
    								cout<<"Account Number	:"<<delcustomerid<<endl;
    								cout<<"Balance			:"<<studentsaving1[x]->Balance-studentsaving1[x]->overdraft<<endl;
    								cout<<"Overdraft		:"<<studentsaving1[x]->overdraft<<endl;
    								cout<<"-----------------------------------------"<<endl;
    								cout<<"Available		:"<<studentsaving1[x]->Balance<<endl;
    
    							}
    							
    						}
    					}
    				}
    				if(acctype==5)
    				{
    					int amt;
    					for(int x =0; x==personalloan1.size(); x++)
    					{
    						if(personalloan1[x]->PersonalLoanid==delcustomerid)
    						{
    							cout<<"Account Number	:"<<delcustomerid<<endl;
    							cout<<"Balance			:"<<personalloan1[x]->Balance<<endl;
    							cout<<"-----------------------------------------"<<endl;
    							cout<<"Available		:"<<personalloan1[x]->Balance<<endl;
    							cout<<"Please enter the ammount you want to withdraw............."<<endl;
    							cin>>amt;
    							if(amt>personalloan1[x]->Balance)
    							{
    								cout<<"Sorry amount is more than what you have"<<endl;
    								
    							}
    							else
    							{
    								personalloan1[x]->Balance=(personalloan1[x]->Balance-amt);
    								cout<<"Account Number	:"<<delcustomerid<<endl;
    								cout<<"Balance			:"<<personalloan1[x]->Balance<<endl;
    								cout<<"-----------------------------------------"<<endl;
    								cout<<"Available		:"<<personalloan1[x]->Balance<<endl;
    
    							}
    							
    						}
    					}
    				}
    
    
    				if(acctype==6)
    				{
    					int amt;
    					for(int x =0; x==corporateloan1.size(); x++)
    					{
    						if(corporateloan1[x]->CorporateLoanid==delcustomerid)
    						{
    							cout<<"Account Number	:"<<delcustomerid<<endl;
    							cout<<"Balance			:"<<corporateloan1[x]->Balance<<endl;
    							cout<<"-----------------------------------------"<<endl;
    							cout<<"Available		:"<<corporateloan1[x]->Balance<<endl;
    							cout<<"Please enter the ammount you want to withdraw............."<<endl;
    							cin>>amt;
    							if(amt>corporateloan1[x]->Balance)
    							{
    								cout<<"Sorry amount is more than what you have"<<endl;
    								
    							}
    							else
    							{
    								corporateloan1[x]->Balance=(corporateloan1[x]->Balance-amt);
    								cout<<"Account Number	:"<<delcustomerid<<endl;
    								cout<<"Balance			:"<<corporateloan1[x]->Balance<<endl;
    								cout<<"-----------------------------------------"<<endl;
    								cout<<"Available		:"<<corporateloan1[x]->Balance<<endl;
    
    							}
    							
    						}
    					}
    				}
    				if(acctype==7)
    				{
    					int amt;
    					for(int x =0; x==mortgage1.size(); x++)
    					{
    						if(mortgage1[x]->Mortgageid==delcustomerid)
    						{
    							cout<<"Account Number	:"<<delcustomerid<<endl;
    							cout<<"Balance			:"<<mortgage1[x]->Balance<<endl;
    							cout<<"-----------------------------------------"<<endl;
    							cout<<"Available		:"<<mortgage1[x]->Balance<<endl;
    							cout<<"Please enter the ammount you want to withdraw............."<<endl;
    							cin>>amt;
    							if(amt>mortgage1[x]->Balance)
    							{
    								cout<<"Sorry amount is more than what you have"<<endl;
    								
    							}
    							else
    							{
    								mortgage1[x]->Balance=(mortgage1[x]->Balance-amt);
    								cout<<"Account Number	:"<<delcustomerid<<endl;
    								cout<<"Balance			:"<<mortgage1[x]->Balance<<endl;
    								cout<<"-----------------------------------------"<<endl;
    								cout<<"Available		:"<<mortgage1[x]->Balance<<endl;
    
    							}
    							
    						}
    					}
    				}
    			 }
    			}
    			break;
    			case 6:
    			{
    				int delcustomerid;
    				int acctype;
    				int y =0;
    				cout<<"Customerid		Accountid		Type"<<endl;	
    								
    				for(int x =0; x==currentaccount1.size(); x++, y++)
    				{
    					cout<<"1	"<<currentaccount1[x]->Customerid<<"		"<<currentaccount1[x]->CurrentAccountid<<"		Current Account"<<endl;	
    				}
    
    				for(int x =0; x==savingaccount1.size(); x++,y++)
    				{
    					cout<<"2	"<<savingaccount1[x]->Customerid<<"		"<<savingaccount1[x]->SavingAccountid<<"		Saving Account"<<endl;	
    				}
    
    				for(int x =0; x==corporatesaving1.size(); x++,y++)
    				{
    					cout<<"3	"<<corporatesaving1[x]->Customerid<<"		"<<corporatesaving1[x]->CorporateSavingid<<"		Corporate Saving"<<endl;	
    				}
    				for(int x =0; x==studentsaving1.size(); x++,y++)
    				{
    					cout<<"4	"<<studentsaving1[x]->Customerid<<"		"<<studentsaving1[x]->StudentSavingid<<"		Student Saving"<<endl;	
    				}
    				for(int x =0; x==personalloan1.size(); x++,y++)
    				{
    					cout<<"5	"<<personalloan1[x]->Customerid<<"		"<<personalloan1[x]->PersonalLoanid<<"		Personal Loan"<<endl;	
    				}
    				for(int x =0; x==corporateloan1.size(); x++,y++)
    				{
    					cout<<"6	"<<corporateloan1[x]->Customerid<<"		"<<corporateloan1[x]->CorporateLoanid<<"		Corporate Loan"<<endl;	
    				}
    				for(int x =0; x==mortgage1.size(); x++,y++)
    				{
    					cout<<"7	"<<mortgage1[x]->Customerid<<"		"<<mortgage1[x]->Mortgageid<<"		Mortgage"<<endl;	
    				}
    				if(y==0)
    				{
    				}
    				else
    				{
    				cout<<"Please enter a account type........"<<endl;
    				cin>>acctype;
    
    				cout<<"Please enter a account id........"<<endl;
    				cin>>delcustomerid;
    				if(acctype==1)
    				{
    					int amt;
    					for(int x =0; x==currentaccount1.size(); x++)
    					{
    						if(currentaccount1[x]->CurrentAccountid==delcustomerid)
    						{
    							cout<<"Account Number	:"<<delcustomerid<<endl;
    							cout<<"Balance			:"<<currentaccount1[x]->Balance-currentaccount1[x]->overdraft<<endl;
    							cout<<"Overdraft		:"<<currentaccount1[x]->overdraft<<endl;
    							cout<<"-----------------------------------------"<<endl;
    							cout<<"Available		:"<<currentaccount1[x]->Balance<<endl;
    							cout<<"Please enter the ammount you want to withdraw............."<<endl;
    							cin>>amt;
    							currentaccount1[x]->Balance=(currentaccount1[x]->Balance+amt);
    							cout<<"Account Number	:"<<delcustomerid<<endl;
    							cout<<"Balance			:"<<currentaccount1[x]->Balance-currentaccount1[x]->overdraft<<endl;
    							cout<<"Overdraft		:"<<currentaccount1[x]->overdraft<<endl;
    							cout<<"-----------------------------------------"<<endl;
    							cout<<"Available		:"<<currentaccount1[x]->Balance<<endl;
    						
    						}
    					}
    				}
    								if(acctype==2)
    				{
    					int amt;
    					for(int x =0; x==savingaccount1.size(); x++)
    					{
    						if(savingaccount1[x]->SavingAccountid==delcustomerid)
    						{
    							cout<<"Account Number	:"<<delcustomerid<<endl;
    							cout<<"Balance			:"<<savingaccount1[x]->Balance-savingaccount1[x]->overdraft<<endl;
    							cout<<"Overdraft		:"<<savingaccount1[x]->overdraft<<endl;
    							cout<<"-----------------------------------------"<<endl;
    							cout<<"Available		:"<<savingaccount1[x]->Balance<<endl;
    							cout<<"Please enter the ammount you want to withdraw............."<<endl;
    							cin>>amt;
    							savingaccount1[x]->Balance=(savingaccount1[x]->Balance+amt);
    								cout<<"Account Number	:"<<delcustomerid<<endl;
    								cout<<"Balance			:"<<savingaccount1[x]->Balance-savingaccount1[x]->overdraft<<endl;
    								cout<<"Overdraft		:"<<savingaccount1[x]->overdraft<<endl;
    								cout<<"-----------------------------------------"<<endl;
    								cout<<"Available		:"<<savingaccount1[x]->Balance<<endl;
    
    							
    							
    						}
    					}
    				}
    if(acctype==3)
    				{
    					int amt;
    					for(int x =0; x==corporatesaving1.size(); x++)
    					{
    						if(corporatesaving1[x]->CorporateSavingid==delcustomerid)
    						{
    							cout<<"Account Number	:"<<delcustomerid<<endl;
    							cout<<"Balance			:"<<corporatesaving1[x]->Balance-corporatesaving1[x]->overdraft<<endl;
    							cout<<"Overdraft		:"<<corporatesaving1[x]->overdraft<<endl;
    							cout<<"-----------------------------------------"<<endl;
    							cout<<"Available		:"<<corporatesaving1[x]->Balance<<endl;
    							cout<<"Please enter the ammount you want to withdraw............."<<endl;
    							cin>>amt;
    							corporatesaving1[x]->Balance=(corporatesaving1[x]->Balance+amt);
    								cout<<"Account Number	:"<<delcustomerid<<endl;
    								cout<<"Balance			:"<<corporatesaving1[x]->Balance-corporatesaving1[x]->overdraft<<endl;
    								cout<<"Overdraft		:"<<corporatesaving1[x]->overdraft<<endl;
    								cout<<"-----------------------------------------"<<endl;
    								cout<<"Available		:"<<corporatesaving1[x]->Balance<<endl;
    
    							
    							
    						}
    					}
    				}
    
    
    				if(acctype==4)
    				{
    					int amt;
    					for(int x =0; x==studentsaving1.size(); x++)
    					{
    						if(studentsaving1[x]->StudentSavingid==delcustomerid)
    						{
    							cout<<"Account Number	:"<<delcustomerid<<endl;
    							cout<<"Balance			:"<<studentsaving1[x]->Balance-studentsaving1[x]->overdraft<<endl;
    							cout<<"Overdraft		:"<<studentsaving1[x]->overdraft<<endl;
    							cout<<"-----------------------------------------"<<endl;
    							cout<<"Available		:"<<studentsaving1[x]->Balance<<endl;
    							cout<<"Please enter the ammount you want to withdraw............."<<endl;
    							cin>>amt;
    							studentsaving1[x]->Balance=(studentsaving1[x]->Balance+amt);
    								cout<<"Account Number	:"<<delcustomerid<<endl;
    								cout<<"Balance			:"<<studentsaving1[x]->Balance-studentsaving1[x]->overdraft<<endl;
    								cout<<"Overdraft		:"<<studentsaving1[x]->overdraft<<endl;
    								cout<<"-----------------------------------------"<<endl;
    								cout<<"Available		:"<<studentsaving1[x]->Balance<<endl;
    
    							
    							
    						}
    					}
    				}
    				if(acctype==5)
    				{
    					int amt;
    					for(int x =0; x==personalloan1.size(); x++)
    					{
    						if(personalloan1[x]->PersonalLoanid==delcustomerid)
    						{
    							cout<<"Account Number	:"<<delcustomerid<<endl;
    							cout<<"Balance			:"<<personalloan1[x]->Balance<<endl;
    							cout<<"-----------------------------------------"<<endl;
    							cout<<"Available		:"<<personalloan1[x]->Balance<<endl;
    							cout<<"Please enter the ammount you want to withdraw............."<<endl;
    							cin>>amt;
    							personalloan1[x]->Balance=(personalloan1[x]->Balance+amt);
    								cout<<"Account Number	:"<<delcustomerid<<endl;
    								cout<<"Balance			:"<<personalloan1[x]->Balance<<endl;
    								cout<<"-----------------------------------------"<<endl;
    								cout<<"Available		:"<<personalloan1[x]->Balance<<endl;
    
    							
    							
    						}
    					}
    				}
    
    
    				if(acctype==6)
    				{
    					int amt;
    					for(int x =0; x==corporateloan1.size(); x++)
    					{
    						if(corporateloan1[x]->CorporateLoanid==delcustomerid)
    						{
    							cout<<"Account Number	:"<<delcustomerid<<endl;
    							cout<<"Balance			:"<<corporateloan1[x]->Balance<<endl;
    							cout<<"-----------------------------------------"<<endl;
    							cout<<"Available		:"<<corporateloan1[x]->Balance<<endl;
    							cout<<"Please enter the ammount you want to withdraw............."<<endl;
    							cin>>amt;
    							corporateloan1[x]->Balance=(corporateloan1[x]->Balance+amt);
    								cout<<"Account Number	:"<<delcustomerid<<endl;
    								cout<<"Balance			:"<<corporateloan1[x]->Balance<<endl;
    								cout<<"-----------------------------------------"<<endl;
    								cout<<"Available		:"<<corporateloan1[x]->Balance<<endl;
    
    							
    							
    						}
    					}
    				}
    				if(acctype==7)
    				{
    					int amt;
    					for(int x =0; x==mortgage1.size(); x++)
    					{
    						if(mortgage1[x]->Mortgageid==delcustomerid)
    						{
    							cout<<"Account Number	:"<<delcustomerid<<endl;
    							cout<<"Balance			:"<<mortgage1[x]->Balance<<endl;
    							cout<<"-----------------------------------------"<<endl;
    							cout<<"Available		:"<<mortgage1[x]->Balance<<endl;
    							cout<<"Please enter the ammount you want to withdraw............."<<endl;
    							cin>>amt;
    							mortgage1[x]->Balance=(mortgage1[x]->Balance+amt);
    								cout<<"Account Number	:"<<delcustomerid<<endl;
    								cout<<"Balance			:"<<mortgage1[x]->Balance<<endl;
    								cout<<"-----------------------------------------"<<endl;
    								cout<<"Available		:"<<mortgage1[x]->Balance<<endl;	
    							
    						}
    					}
    				}
    			 }
    			}
    			break;
    
    			break;
    			case 7:
    			{
    				int select10, select11,password;
    				cout<<"Enter admin password......"<<endl;
    				cin>>password;
    				if(password==1234)
    				{				
    					do
    					{
    						select10=0;
    						select11 = adminmenu(select10); 
    						switch (select11)
    						{
    							case 1:
    							{
    								int y=0;
    								cout<<"Customerid	Accountid	Type"<<endl;	
    								
    								for(int x =0; x==currentaccount1.size(); x++, y++)
    								{
    									cout<<currentaccount1[x]->Customerid<<"		"<<currentaccount1[x]->CurrentAccountid<<"		Current Account"<<endl;	
    								}
    
    								for(int x =0; x==savingaccount1.size(); x++,y++)
    								{
    									cout<<savingaccount1[x]->Customerid<<"		"<<savingaccount1[x]->SavingAccountid<<"		Saving Account"<<endl;	
    								}
    	
    								for(int x =0; x==corporatesaving1.size(); x++,y++)
    								{
    										cout<<corporatesaving1[x]->Customerid<<"		"<<corporatesaving1[x]->CorporateSavingid<<"		Corporate Saving"<<endl;	
    								}
    								for(int x =0; x==studentsaving1.size(); x++,y++)
    								{
    									cout<<studentsaving1[x]->Customerid<<"		"<<studentsaving1[x]->StudentSavingid<<"		Student Saving"<<endl;	
    								}
    								for(int x =0; x==personalloan1.size(); x++,y++)
    								{
    									cout<<personalloan1[x]->Customerid<<"		"<<personalloan1[x]->PersonalLoanid<<"		Personal Loan"<<endl;	
    								}
    								for(int x =0; x==corporateloan1.size(); x++,y++)
    								{
    									cout<<corporateloan1[x]->Customerid<<"		"<<corporateloan1[x]->CorporateLoanid<<"		Corporate Loan"<<endl;	
    								}
    								for(int x =0; x==mortgage1.size(); x++,y++)
    								{
    									cout<<mortgage1[x]->Customerid<<"		"<<mortgage1[x]->Mortgageid<<"		Mortgage"<<endl;	
    								}
    								if(y==0)
    								{
    									cout<<"No Customer"<<endl;
    								}
    								else
    								{
    									int wholecustomerid;
    								cout<<"Please enter a Customer ID........"<<endl;
    								cin>>wholecustomerid;
    								for(int x =0; x==customer1.size(); x++)
    								{
    									if(customer1[x]->Customerid==wholecustomerid)
    									{
    											customer1[x]->Display();			
    									}
    								}
    			
    								for(int x =0; x==currentaccount1.size(); x++)
    								{
    									if(currentaccount1[x]->Customerid==wholecustomerid)
    									{
    											currentaccount1[x]->Display();			
    									}
    								}
    			
    								for(int x =0; x==savingaccount1.size(); x++)
    								{
    									if(savingaccount1[x]->Customerid==wholecustomerid)
    									{
    											savingaccount1[x]->Display();							
    									}
    							
    								}
    								for(int x =0; x==corporatesaving1.size(); x++)
    								{
    									if(corporatesaving1[x]->Customerid==wholecustomerid)
    									{
    										corporatesaving1[x]->Display();						
    									}
    								}
    
    								for(int x =0; x==studentsaving1.size(); x++)
    								{
    									if(studentsaving1[x]->Customerid==wholecustomerid)
    									{
    										studentsaving1[x]->Display();			
    									}
    								}
    								for(int x =0; x==personalloan1.size(); x++)
    								{
    									if(personalloan1[x]->Customerid==wholecustomerid)
    									{
    										personalloan1[x]->Display();			
    									}
    								}
    								for(int x =0; x==corporateloan1.size(); x++)
    								{
    									if(corporateloan1[x]->Customerid==wholecustomerid)
    									{
    										corporateloan1[x]->Display();			
    									}
    								}
    								for(int x =0; x==mortgage1.size(); x++)
    								{
    									if(mortgage1[x]->Customerid==wholecustomerid)
    									{
    										mortgage1[x]->Display();
    									}
    								}
    								
    								}
    								
    							}
    							break;
    						}
    					}while (select11!=2);
    				}
    				else
    				{
    					cout<<"Wrong Password......"<<endl;
    				}
    
    	
    
    
    
    
    			}
    		
    		}
    	}while (select2!=8);
    
    }

  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    I think there's absolutely no way I'm going to look at all that code. Two comments:
    1) Your lines are too long. Not only do they mess up this forum, they're also overflowing the lines of most people's IDEs that way.
    2) Your main() is waaaaaaay too long. Make every case its own function.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  3. #3
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,756
    Use std::string, and not chars.
    Your code seems to be too much C-esque. You need to learn to think in terms of C++ ways.
    And don't store pointers in the vectors. Store actual objects. You currently end up with huge leaks.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Are you sitting down comfortably? This will take some time. Please take these comments as "I've worked for 20 years in programming, and I'm trying to help you". You wouldn't have posted the code if you didn't want comments, I know that, but perhaps you expected just a few small comments.

    Why not use C++ string, instead of char arrays?

    I get LOTS of warnings for mixing unsigned and signed in comparisons where you are using vector::size().

    Lots of lines are MUCH longer than 80 characters.

    Code:
    						while(select4!=1&&select4!=2&&select4!=2&&select4!=3&&select4!=4&&select4!=5&&select4!=6&&select4!=7);
    is much easier to read as:
    Code:
    						while(select4>1 && select4<7);
    And there's obviously no point in checking for 2 twice in the same statement - either it is two, or it isn't.

    Code:
    				for(int x =0; x == customer1.size(); x++)
    				{
    					if(customer1[x]->Customerid==delcustomerid)
    					{
    						customer1.erase(customer1.begin()+x,customer1.begin()+1+x);
    						x=0;
    					}
    				}
    				for(int x =0; x==currentaccount1.size(); x++)
    				{
    					if(currentaccount1[x]->Customerid==delcustomerid)
    					{
    						currentaccount1.erase(currentaccount1.begin()+x,currentaccount1.begin()+1+x);
    						x=0;
    					}
    				}
    ...
    				for(int x =0; x==debitcard1.size(); x++)
    				{
    					if(debitcard1[x]->Customerid==delcustomerid)
    					{
    						debitcard1.erase(debitcard1.begin()+x,debitcard1.begin()+1+x);
    						x=0;
    					}
    				}
    				for(int x =0; x==creditcard1.size(); x++)
    				{
    					if(creditcard1[x]->Customerid==delcustomerid)
    					{
    						creditcard1.erase(creditcard1.begin()+x,creditcard1.begin()+1+x);
    						x=0;
    					}
    				}
    				for(int x =0; x==cheque1.size(); x++)
    				{
    					if(cheque1[x]->Customerid==delcustomerid)
    					{
    						cheque1.erase(cheque1.begin()+x,cheque1.begin()+1+x);
    						x=0;
    					}
    				}
    This whole section would be MUCH easier if you kept one structure of all the customer data, rather than a customer entry, a creditcard entry, a mortgage entry, etc, etc. Store all the data on a customer in one structure (class or struct). If something isn't being used (e.g. no mortgage for a particular customer), then you can just have a special marker value for the mortgage section to say "this customer doesn't have a mortgage".
    Also, I presume you set x = 0 to avoid problems when you delete the last entry. Perhaps you'd be better off using the "break" keyword to stop the loop - I presume there isn't more than one entry for any particular customer for any of the vectors.

    CurrentAccount and SavingsAccount perhaps should be inheriting from a BaseAccount, to avoid code duplication (in fact, there are many places where code is simply repeated, when it probably should be functions).

    Code:
    int addmenu(int value2)
    {
    
    		cout<<"------- Select Account -------"<<endl;
    		cout<<"1      Current Account"<<endl;
    		cout<<"2      Savings Account"<<endl;
    		cout<<"3      CorporateSaving"<<endl;
    		cout<<"4      StudentSaving"<<endl;
    		cout<<"5      Corporate Loan"<<endl;
    		cout<<"6      Personal Loan"<<endl;
    		cout<<"7      Mortgage"<<endl;
    		cout<<""<<endl;
    		cout<<"-----------------------------"<<endl;
    		cout<<"Please Select An Option......"<<endl;
    		cout<<""<<endl;
    
    		int o;
    		cin>>o;
    		cout<<""<<endl;
    		value2 = o;
    		return value2;
    
    }
    Several things here:
    Using variables called "o" is a bad idea! They look too much like zero.
    Why are you passing in a value2, that is only ever used to store o before it's being returned? Since it is a parameter (and not a reference), the outside variable corresponding to value2 doesn't change, and it is not being used inside the fucntion for any purpose.
    The two lines marked in red have a completely useless empty string in them -
    Code:
    cout << endl;
    will do exactly the same thing (but a little bit more efficient, as you are not passing an empty string around to be printed).

    Same comment applies to a few other similar functions.

    The function main() is VERY much too large - nearly 1400 lines of code, and whilst I may agree with Laserlight that function size is somewhat a coding style issue, that is definitely beyond what ANYONE will recommend. [Exceptions do exist, but this certainly looks like a function that can be split into several portions].

    I think that will be enough for now.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  5. #5
    The larch
    Join Date
    May 2006
    Posts
    3,573
    There are only new expressions but not a single delete in the code (and no smart pointers), so it will leak memory.

    Code:
    for(int x =0; x == customer1.size(); x++)
    I fail to see how these and similar loops loop at all.

    Code:
    customer1.erase(customer1.begin()+x,customer1.begin()+1+x);
    There is another version of vector::erase that erases one item pointed to by the iterator.
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

  6. #6
    Registered User
    Join Date
    Apr 2008
    Posts
    7
    thank you for your comments i will get to work thank you all

  7. #7
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,308
    Eeeeeek, that's horrible! You must absolutely LOVE typing, because that program should be about ten times shorter, and no I'm not exaggerating, if anything that's pessimistic...

    That code is absolutely screaming out for someone to make a common base class for accounts. Really, it's screaming so painfully loud and screeching! The first 4 members from CurrentAccount at least could go in the base class. Please please pleeeease, learn about polymorphism and virtual functions!

    Don't store items by pointer in the vector when you don't have to. Gaaaaah the memory leaks!

    Aaaaaargh, the cyclomatic complexity is off the charts!

    Oh the torture, I now have to go and purge the last few minutes of memory from my head.
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21