hi every 1 please i need your help to complete my code cause i could not complete it
it is for a bank wich
. Design it so it can be used by the bank’s staff. It should enable the following:
o Opening a new account for a customer
o Closing an account
o Displaying all accounts

An Account
o Contains the name of the customer
o Contains the account balance.
o Enables withdrawal from the account
o Enables depositing to the account
and
Transactions
Each account stores transactions information (the type of transaction (e.g. withdrawal, deposit …etc), the amount, the time of transaction and any additional information you think is important). When any transaction occurs this transaction is recorded in the account. So each account has more than one transaction. You should enable printing a report of a transactions performed on an account
Standing orders
In addition each account contains a number of standing orders .Standing orders store the following information (the day of the month which it is paid, the regular amount to be paid and to whom the SO is payable). You should enable adding, deleting and processing a standing order. Processing an SO means checking if the day of the month is today, if it is, then withdraws the amount from the account and recording this as a transaction. You should enable processing standing orders for all accounts.

Account Types
Extend account so that there will be two types of accounts
o Personal account
o When the account is overdrawn there is a charge of 10 $
o Company account
o On each withdrawal, or deposit there is a charge of 5 cents

here is the code i want to complete please help me as herry as you can

#include <vector>
#include <string>
#include <iostream>

using namespace::std;

class Account
{

 public:
	Account();
	Account(string num, string n, double b);
	
	void setName(string n);
	string getName();

	void setNum(string n);
	string getNum();

	void setbalance(double bal);
	double getbalance();

	void withdraw(double amount);
	void deposit (double amount);
    
	
 private:
 	string name;
	string AccNum;
	double balance;
void display;

};


class Bank
{

public:
	void DisplayAllAccounts();
	
	void OpenAccount();
	
	void CloseAccount(); 
	
	int FindAccountbyNumber(string accnum);
	//Returns the index for the account having this number
	
	int FindAccountbyName  (string name);
	//Returns the index for the account having this name
	
		void Withdraw();

	void Deposit();

	void ShowAccount();
	
 private:
	
	vector<Account *> Accs; //A vector of account pointers
};

void Bank::OpenAccount()
{
	string accnum;
	string name;
	double OpeningBalance;
	// Read accnum,name,OpeningBalance from the user

	Accs.push_back(new Account(accnum,name,OpeningBalance));
}


void Bank::CloseAccount()
{
	int i;	
	
	string accnum;
	string name;

	
	//Read the account number or name from the user

	
	i = FindAccountbyNumber(accnum);
	//or
	i = FindAccountbyName(name);

	if (i != -1)
	{
		vector<Account *>::iterator p = Accs.begin();
		p +=i;
		delete Accs[i];
		Accs.erase(p,p+1);
	}
}


void Bank::Withdraw()
{
	int i;	
	
	string accnum;
	string name;
	double amount, Newbalance; 
	
	//Read the account number or name from the user
	//Read the amount to be withdrawn

	i = FindAccountbyNumber(accnum);
	//or
	i = FindAccountbyName(name);

	if (i != -1)
	{
		Accs[i]->withdraw(amount);
		//Get the current balance
		Newbalance = Accs[i]->getbalance();

		//Display the current balance
	}
}


}

here is my try to complete it i have 9 error

#include <vector>
#include <string>
#include <iostream>
using namespace::std;


class Account
{
 
 string name;
 string AccNum;
 double balance;
 string AccType;

 public:

 Account();//defalt constructor
 
 void setName(string n);//enter customer's name
 string getName();//return customer's name

 void setNum(string n);//enter account's number
 string getNum();//return account's number

 void setbalance(double bal);//enter customer's balance
 double getbalance();//return account's balance

 void settype(string T);
 string gettype();

 void withdraw(double amount);
 void deposit (double amount);
 double zakat();//calculate customer's zakat

 void disolayaccount();//display account info
 

};

///////////////////////BANK//////////////////////////////

class Bank
{
	
 Account ZakatAccount;// holds the balance of zakat account
 vector<Account *> Accs; //A vector of account pointers

public:

 void DisplayAllAccounts();//display all accounts info
 
 void OpenAccount();//open new acount
 
 void CloseAccount(); //close an account

 int FindAccountbyNumber(string accnum);
 //search for an aaccount by account's number
 //Returns the index for the account having this number
 
 
 void Do_Zakat();
 void Withdraw();
 void Deposit();
 void ShowAccount();
 
};// end of bank

//////////////////TRANSACTIONS/////////////////////////////
class transactions
{

	string OpType;
	string Date;
	double amount;
public:
	void setOpType
};
/////////////////DEFAULT CONSTRUCTOR////////////////////////

Account::Account()
{
name="\0";
AccNum="\0";
AccType="\0";
balance=0.0;
};

///////////////////SET NAME///////////////////

void Account::setName(string n)
{
 name=n;
}

//////////////////SET ACCOUNT NUMBER///////////

void Account::setNum(string n)
{
 AccNum=n;
}

//////////////////SET BALANCE////////////////

void Account::setbalance(double bal)
{
balance=bal;
}

///////////////////SET TYPE////////////////

void Account::settype(string T)
{
AccType=T;
}

//////////////////GET TYPE//////////////////

string Account::gettype()
{
 return AccType;
}

///////////////////GET NAME////////////////

string Account::getName()
{
 return name;
}

/////////////GE TACCOUNT NUMBER////////////

string Account::getNum()
{
 return AccNum;
}

///////////////GET BALANCE////////////////

double Account::getbalance()
{
return balance;
}

////////////////WITHDRAW//////////////////

void Account::withdraw(double amount)
{
	if (AccType=="personal")
	{
      balance=balance-amount;
      setbalance(balance);
	}


	if (AccType=="company")
	{
		balance=balance-amount-0.05;
		setbalance(balance);
}

//////////////DEPOSTE///////////////////

void Account::deposit(double amount)
{
	if (AccType=="personal")
	{
		balance=balance+amount;
		setbalance(balance);
	}

	if (AccType=="company")
	{
		balance=balance+amount-0.05;
		setbalance(balance);
	}
}




/////////////FIND ACCOUNT//////////////

int Bank::FindAccountbyNumber(string accnum)
{
for (int j=0;j<Accs.size();j++)
{
 if (!strcmp(Accs[j]->getNum,accnum))
  return j;
}
return -1;
}

/************(BANK)*************************/
/////////////OPEN NEW ACCOUNT////////////////
void Bank::OpenAccount()
{
 string accnum;
 string name;
 string acctype
 double OpeningBalance;
 int i=0;
 
 cout<<"ENTER CUSTOMER NAME: ";
 cin>>name;
 //Accs[i]->setName(name);

 cout<<"ENTER CUSTOMER BALANCE: ";
 cin>>OpeningBalance;
 //Accs[i]->setbalance(OpeningBalance);

 cout<<"ENTER ACCOUNT'S NUMBER: ";
 cin>>accnum;
 //Accs[i]->setNum(accnum);

 cout<<"ENTER ACCOUNT TYPE (PERSONAL OR COMPANY): ";
 cin>>acctype;
 //Accs[i]->settype(acctype);
 
 Accs.push_back(new Account(accnum,name,OpeningBalance,acctype));
}

////////////CLOSE ACCOUNT///////////////////////

void Bank::CloseAccount()
{
 int i; 
 
 string accnum;
 cout<<"ENTER THE NUMER OF ACCOUNT's YOU WANT TO CLOSE: ";
 cin>>accnum;
 
 i = FindAccountbyNumber(accnum);
 
 if (i != -1)
 {
  vector<Account *>::iterator p = Accs.begin();
  p +=i;//gives the indix of this account
  delete Accs[i];//closing account
  Accs.erase(p,p+1);
 }
}

/////////////////WITHDRAW//////////////////////

void Bank::Withdraw()
{
 int i; 
 
 string accnum;
 double amount, Newbalance; 
 cout<<"ENTER THE  NUMBER OF ACCOUNT YOU WANT TO WITHDRAW FROM: ";
 cin>>accnum;//the account number from the user

 cout<<"HOW MANY HE SHE WANT TO WITHDRAW? ";
 cin>>amount;//the amount to be withdrawn

 i = FindAccountbyNumber(accnum);
 if (i != -1)
 {
  Accs[i]->withdraw(amount);
  //Get the current balancel
  Newbalance = Accs[i]->getbalance();
  cout<<"NEW BALANCE = "<<Newbalance<<endl;//Display the current balance
 }
}
////////////////DEPOSITE////////////////////////
void Bank::Deposit(){
 int i; 
 
 string accnum;
 double amount, Newbalance; 

 cout<<"ENTER THE ACCOUNT S NUMBER YOU WANT TO DEPOSE TO: ";
 cin>>accnum;//the account number from the user

 cout<<"HOW MANY HE SHE WANT TO DEPOSE? ";
 cin>>amount;//the amount to be depsite

 i = FindAccountbyNumber(accnum);

 if (i != -1)
 {
  Accs[i]->deposit(amount);
  //Get the current balance

  Newbalance = Accs[i]->getbalance();

  cout<<"NEW BALANCE = "<<Newbalance<<endl;//Display the current balance
 }
}
//////////////DO ZAKAT///////////////////////////



///////////////////////MAIN/////////////////////////
int main()
{
 Bank b;
char choice;

 
while (flag == false) {
      cout << "\t\t\n\n" << "Main Menu";
      cout << "\t\n\n" << "Select by letter:";
      cout << "\t\n" << "o - open new account.";
      cout << "\t\n" << "d - Deposit money.";
      cout << "\t\n" << "w - Withdraw money.";
      cout << "\t\n" << "s - Show Account Information.";
	  
      cout << "\t\n" << "c _ close account.";
      cout << "\t\n" << "q - Quit Application.\n\n";
      cout << "\t" << "Choice: ";
      cin>>choice ;
	  // END OF THE MENU
	  cout<<fixed;
      switch(choice) {
         case 'o':
            system("cls");
            b.OpenAccount();
            
            break;

         case 'd':
            system("cls");
            
            b.Deposit();
            
            break;

         case 'w':
            system("cls");
           
            b.Withdraw();

            system("cls");
            break;
         case 's':
            system("cls");
           
            b.DisplayAllAccounts();
            
            system("cls");
            break;
		 
           case 'c':
            system("cls");
            
            b.CloseAccount();
			
            system("cls");
            break;

         case 'q':
            flag = 1;
            break;

         default:
            cout << "\nInvalid selection. Press a key to return to main menu.";
           
      }

      if (flag == true) {
         break;
      }

   }
   
   return 0;
}

}

errors

C:\Documents and Settings\noone\Desktop\phase2.cpp(77) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\noone\Desktop\phase2.cpp(77) : error C2182: 'setOpType' : illegal use of type 'void'
C:\Documents and Settings\noone\Desktop\phase2.cpp(164) : error C2601: 'deposit' : local function definitions are illegal
C:\Documents and Settings\noone\Desktop\phase2.cpp(184) : error C2601: 'FindAccountbyNumber' : local function definitions are illegal
C:\Documents and Settings\noone\Desktop\phase2.cpp(196) : error C2601: 'OpenAccount' : local function definitions are illegal
C:\Documents and Settings\noone\Desktop\phase2.cpp(225) : error C2601: 'CloseAccount' : local function definitions are illegal
C:\Documents and Settings\noone\Desktop\phase2.cpp(246) : error C2601: 'Withdraw' : local function definitions are illegal
C:\Documents and Settings\noone\Desktop\phase2.cpp(267) : error C2601: 'Deposit' : local function definitions are illegal
C:\Documents and Settings\noone\Desktop\phase2.cpp(297) : error C2601: 'main' : local function definitions are illegal
Error executing cl.exe.

try to fix the errors one at a time. Take the first error for example. It says there is something wrong on line 77, which is nothing more than "};". Nothing wrong there, so the prioblem must be above that line. Look at line 76 -- what's wrong with it? It looks as if its a POD (Plain Old Data) data type, but you can't declare a POD of type void, so I suppose you indend for setOpType to be a function. If its a function, then its missing "()" and the semicolon at the end. Fix that problem then recompile, that will probably fix some of the other errors. Then do the same with the other errors until you get a clean compile. Its just a matter of learning to recognize mistakes in your code. The compiler gives you a hint where to look and the problem is almost always in that line or the line above.

thanks

>>>>local function definitions are illegal

how can i fix this i did not found any error

and please if you know how to complete it

thanks

>>>>local function definitions are illegal

how can i fix this i did not found any error

and please if you know how to complete it

function withdraw() is missing a closing brace'}'.

i have fixed it and the other errors but still one error
sorry i know i maybe ask alot but relly i want to know

here is the code after fix
and the error below

#include <vector>
#include <string>
#include <iostream>
using namespace::std;


class Account
{
 
 string name;
 string AccNum;
 double balance;
 string AccType;

 public:

 Account();//defalt constructor
 
 void setName(string n);//enter customer's name
 string getName();//return customer's name

 void setNum(string n);//enter account's number
 string getNum();//return account's number

 void setbalance(double bal);//enter customer's balance
 double getbalance();//return account's balance

 void settype(string T);
 string gettype();

 void withdraw(double amount);
 void deposit (double amount);
 double zakat();//calculate customer's zakat

 void disolayaccount();//display account info
 

};

///////////////////////BANK//////////////////////////////

class Bank
{
	
 
 vector<Account *> Accs; //A vector of account pointers

public:

 void DisplayAllAccounts();//display all accounts info
 
 void OpenAccount();//open new acount
 
 void CloseAccount(); //close an account

 int FindAccountbyNumber(string accnum);
 //search for an aaccount by account's number
 //Returns the index for the account having this number
 
 
 
 void Withdraw();
 void Deposit();
 void ShowAccount();
 
};// end of bank

//////////////////TRANSACTIONS/////////////////////////////
class transactions
{

	string OpType;
	string Date;
	double amount;
public:
	void setOpType();
};
/////////////////DEFAULT CONSTRUCTOR////////////////////////

Account::Account()
{
name="\0";
AccNum="\0";
AccType="\0";
balance=0.0;
};

///////////////////SET NAME///////////////////

void Account::setName(string n)
{
 name=n;
}

//////////////////SET ACCOUNT NUMBER///////////

void Account::setNum(string n)
{
 AccNum=n;
}

//////////////////SET BALANCE////////////////

void Account::setbalance(double bal)
{
balance=bal;
}

///////////////////SET TYPE////////////////

void Account::settype(string T)
{
AccType=T;
}

//////////////////GET TYPE//////////////////

string Account::gettype()
{
 return AccType;
}

///////////////////GET NAME////////////////

string Account::getName()
{
 return name;
}

/////////////GE TACCOUNT NUMBER////////////

string Account::getNum()
{
 return AccNum;
}

///////////////GET BALANCE////////////////

double Account::getbalance()
{
return balance;
}

////////////////WITHDRAW//////////////////

void Account::withdraw(double amount)
{
	if (AccType=="personal")
	{
      balance=balance-amount;
      setbalance(balance);
	}


	if (AccType=="company")
	{
		balance=balance-amount-0.05;
		setbalance(balance);
}}

//////////////DEPOSTE///////////////////

void Account::deposit(double amount)
{
	if (AccType=="personal")
	{
		balance=balance+amount;
		setbalance(balance);
	}

	if (AccType=="company")
	{
		balance=balance+amount-0.05;
		setbalance(balance);
	}
}




/////////////FIND ACCOUNT//////////////

int Bank::FindAccountbyNumber(string accnum)
{
for (int j=0;j<Accs.size();j++)
{
 if (!strcmp(Accs[j]->getNum,accnum))
  return j;
}
return -1;
}

/************(BANK)*************************/
/////////////OPEN NEW ACCOUNT////////////////
void Bank::OpenAccount()
{
 string accnum;
 string name;
 string acctype;
 double OpeningBalance;
 int i=0;
 
 cout<<"ENTER CUSTOMER NAME: ";
 cin>>name;
 //Accs[i]->setName(name);

 cout<<"ENTER CUSTOMER BALANCE: ";
 cin>>OpeningBalance;
 //Accs[i]->setbalance(OpeningBalance);

 cout<<"ENTER ACCOUNT'S NUMBER: ";
 cin>>accnum;
 //Accs[i]->setNum(accnum);

 cout<<"ENTER ACCOUNT TYPE (PERSONAL OR COMPANY): ";
 cin>>acctype;
 //Accs[i]->settype(acctype);
 
 Accs.push_back(new Account);
}

////////////CLOSE ACCOUNT///////////////////////

void Bank::CloseAccount()
{
 int i; 
 
 string accnum;
 cout<<"ENTER THE NUMER OF ACCOUNT's YOU WANT TO CLOSE: ";
 cin>>accnum;
 
 i = FindAccountbyNumber(accnum);
 
 if (i != -1)
 {
  vector<Account *>::iterator p = Accs.begin();
  p +=i;//gives the indix of this account
  delete Accs[i];//closing account
  Accs.erase(p,p+1);
 }
}

/////////////////WITHDRAW//////////////////////

void Bank::Withdraw()
{
 int i; 
 
 string accnum;
 double amount, Newbalance; 
 cout<<"ENTER THE  NUMBER OF ACCOUNT YOU WANT TO WITHDRAW FROM: ";
 cin>>accnum;//the account number from the user

 cout<<"HOW MANY HE SHE WANT TO WITHDRAW? ";
 cin>>amount;//the amount to be withdrawn

 i = FindAccountbyNumber(accnum);
 if (i != -1)
 {
  Accs[i]->withdraw(amount);
  //Get the current balancel
  Newbalance = Accs[i]->getbalance();
  cout<<"NEW BALANCE = "<<Newbalance<<endl;//Display the current balance
 }
}
////////////////DEPOSITE////////////////////////
void Bank::Deposit(){
 int i; 
 
 string accnum;
 double amount, Newbalance; 

 cout<<"ENTER THE ACCOUNT S NUMBER YOU WANT TO DEPOSE TO: ";
 cin>>accnum;//the account number from the user

 cout<<"HOW MANY HE SHE WANT TO DEPOSE? ";
 cin>>amount;//the amount to be depsite

 i = FindAccountbyNumber(accnum);

 if (i != -1)
 {
  Accs[i]->deposit(amount);
  //Get the current balance

  Newbalance = Accs[i]->getbalance();

  cout<<"NEW BALANCE = "<<Newbalance<<endl;//Display the current balance
 }
}
//////////////DO ZAKAT///////////////////////////



///////////////////////MAIN/////////////////////////
void main()
{
 Bank b;
char choice;

 bool flag =0;
while (flag == false) {
      cout << "\t\t\n\n" << "Main Menu";
      cout << "\t\n\n" << "Select by letter:";
      cout << "\t\n" << "o - open new account.";
      cout << "\t\n" << "d - Deposit money.";
      cout << "\t\n" << "w - Withdraw money.";
      cout << "\t\n" << "s - Show Account Information.";
	  
      cout << "\t\n" << "c _ close account.";
      cout << "\t\n" << "q - Quit Application.\n\n";
      cout << "\t" << "Choice: ";
      cin>>choice ;
	  // END OF THE MENU
	  cout<<fixed;
      switch(choice) {
         case 'o':
            system("cls");
            b.OpenAccount();
            
            break;

         case 'd':
            system("cls");
            
            b.Deposit();
            
            break;

         case 'w':
            system("cls");
           
            b.Withdraw();

            system("cls");
            break;
         case 's':
            system("cls");
           
            b.DisplayAllAccounts();
            
            system("cls");
            break;
		 
           case 'c':
            system("cls");
            
            b.CloseAccount();
			
            system("cls");
            break;

         case 'q':
            flag = 1;
            break;

         default:
            cout << "\nInvalid selection. Press a key to return to main menu.";
           
      }

      if (flag == true) {
         break;
      }

   }
   
  
}

error

error C2664: 'strcmp' : cannot convert parameter 1 from 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > (void)' to 'const char *'
There is no context in which this conversion is possible

do i have to change return type

I don't know which line contains the error, but you don't use strcmp() when comparing std::string object to something, just use its == operator

int Bank::FindAccountbyNumber(string accnum)
{
for (int j=0;j<Accs.size();j++)
{
 if (Accs[j]->getNum() == accnum)
 //if (!strcmp(Accs[j]->getNum,accnum))
  return j;
}
return -1;
}

once you have fixed that the compiler will probably produce a link error because you haven't coded function Bank::DisplayAllAccounts().

thanks
i have fixed it all and now i am trying to complete all the function in this program
i do not mind if you like to help in complete it esppisally at the TRANSACTIONS
thanks alot for your help

This article has been dead for over six months. Start a new discussion instead.