I am currently trying to implement a delete function within my system, to allow my to delete an account from within the account vector array and I am unable to work out how to do it, I am a complete rookie when it comes to C++ so any help would be appreciated, I do fear that the way that I call my create Account and my create person function are stopping me from searching arrays, so is it possible to name a created object before putting it in the appropriate array.
string CustTitle;
string Custfirst;
string Custlast;
int CustNo;
string CustLocation;
Person* createPerson(int CustNo, string CustTitle, string Custfirst, string Custlast, string CustLocation);
int numSearch;
CustomerArray c("string");
Person p("string");
Person* test;
char ch;
void intro();
do
{
system("cls");
cout<<"\n\n\n\t---MAIN MENU---";
cout<<"\n\n\t01. CREATE NEW ACCOUNT";
cout<<"\n\n\t02. LIST ACCOUNTS";
cout<<"\n\n\t03. CREATE CUSTOMER";
cout<<"\n\n\t04. LIST CUSTOMERS";
cout<<"\n\n\t05. LIST CUSTOMERS ACCOUNTS";
cout<<"\n\n\t06. CREATE NEW ACCOUNT";
cout<<"\n\n\t07. DELETE ACCOUNT";
cout<<"\n\n\t08. EXIT";
cout<<"\n\n\tSelect Your Option (1-8) ";
cin>>ch;
system("cls");
switch(ch)
{
case '1':
int intialBalance;
int intialInterest;
int accNo;
cout << "\n\n\tPlease enter an Account Number: ";
cin >> accNo;
cout << "\n\n\tPlease enter an intial balance: ";
cin >> intialBalance;
cout << "\n\n\tPlease enter an interest rate: ";
cin >> intialInterest;
test->addAccount(new Account(intialBalance, intialInterest, accNo));
break;
case '2':
p.PrintAllAccounts();
break;
case '3':void intro();
cout << "\n\n\tPlease enter Customers Number: ";
cin >> CustNo;
cout << "\n\n\tPlease enter Customers title: ";
cin >> CustTitle;
cout << endl;
cout << "\n\n\tCustomers First Name: ";
cin >> Custfirst;
cout << endl;
cout << "\n\n\tCustomers Last Name: ";
cin >> Custlast;
cout << endl;
cout << "\n\n\tCustomers Date of Birth(ddmmyyyy): ";
cin >> CustLocation;
test = createPerson(CustNo, CustTitle, Custfirst, Custlast, CustLocation);
c.addCustomer(test);
break;
case '4':
c.CustPrint();
break;
case '5':
cout<<"\n\n\tEnter Customer No.: ";
cin >> numSearch;
c.searchAccount(numSearch);
break;
case '6':
//deposit(double amount);
cout<<"\n\n\tThanks for using bank managemnt system";
break;
case '7':
//Call delete method
break;
case '8':
cout<<"\n\n\tThanks for using bank managemnt system";
break;
default :cout<<"\a";
}
cin.ignore();
cin.get();
}while(ch!='8');
}