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

class customer{
	private:
	char type;
	double balance;

public:
	void check_type(){

	if(type=='p'){
		if (balance<1000) {
			balance=balance-2;}
else
if (balance<1000) {
	balance=balance-5;}
}
	}
	};
	
class Transactions{
private:
	char type;
	double amount;
	int houre;
	int minute;
public:
    Transactions(char t,double a,int h,int m):type(t),amount(a),houre(h),minute(m)
	{}
	void print()
	{if (type=='w')
	cout<<"-Withdrawal("<<amount<<")...AT:"<<houre<<":"<<minute<<"\n";
	if (type=='d')
	cout<<"-Deposition("<<amount<<")...AT:"<<houre<<":"<<minute<<"\n";
	if (type=='z')
	cout<<"-Zakat("<<amount<<")...AT:"<<houre<<":"<<minute<<"\n";
	if (type=='s')
	cout<<"-Standing Order("<<amount<<")...AT:"<<houre<<":"<<minute<<"\n";
	}
};
////////////////////////////////////////////////////////////
class Standing_orders
{
private:
	int day;
	double amount;
	string name;
public:
 Standing_orders(int d,double a,string n):day(d),amount(a),name(n)
	{}
 int getday()
 {return day;}
 double getamount()
 {return amount;}
 string getname()
 {return name;}
};
////////////////////////////////////////////////////////////
class Account
{
private:
 	string name;
	int AccNum;
	double balance;
	char type;
	vector<Standing_orders *> SO;
	
public:
	vector<customer *> cust;
	vector<Transactions *> Trans;
	Account():AccNum(0),name(""),balance(0)
	{}

	Account(int n,string na, double b,char t):
	                 name(na),AccNum(n),balance(b),type(t)
					 {}
//check_type
	 void checktype(char type,double balance ){

	if(type=='p'){
		if (balance<1000) {
			balance=balance-2;}
else
if (balance<1000) {
	balance=balance-5;}
}
	cust.check_type(type,balance);
	 }
	void addSO(int day,double amount,string name)
	{SO.push_back(new Standing_orders(day,amount,name));}
	void closeSO(int day,double amount)
	{int i=0,m=-1;
	 int n=SO.size();
     while ((i<n) && (m<0))
	 {if ((SO[i]->getday()==day) && (SO[i]->getamount()==amount))
	     m=i;
	  else i++;}
      vector<Standing_orders *>::iterator p = SO.begin();
	  p +=i;
	  delete SO[i];
	  SO.erase(p,p+1);}
	void procSO()
	{int n=SO.size();
	 SYSTEMTIME st;
     GetSystemTime(&st);
	 int day=st.wDay;
	 for (int i=0;i<n;i++)
	  if (SO[i]->getday()==day)
	  {
Trans.push_back(new Transactions('s',SO[i]->getamount(),st.wHour,st.wMinute));
	  balance=balance-SO[i]->getamount();}
	}

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

	string getName()
    {return name;}

	void setNum(int n)
	{AccNum=n;}

	int getNum()
	{return AccNum;}

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

	double getbalance()
	{return balance;}
	void withdraw(double amount)
	{balance=balance-amount;
	}

	
	

	void deposit(double amount)
	{balance=balance+amount;}
	double zakat()
	{double z;
	 if (balance>=4000)
	  z=(balance*2.5)/100;
	 else
	  z=0;
	  if (z==0) 
         cout<<"This account dont reached the Zakat amount\n";
	  return z;}
	void showone()
	{
cout<<AccNum<<"-"<<name<<"......"<<balance<<"\n";}
	void showTrans()
	{int n=Trans.size();
     for (int j=0;j<n;j++)
     Trans[j]->print();}
};
////////////////////////////////////////////////////////////
class Bank{
private:
	Account ZakatAccount;
	vector<Account *> Accs; 
     
public:
int FindAccountbyNumber(int accnum)
	{int m=-1,i=0;
	 int n=Accs.size();
     while ((i<n) && (m<0))
	 {if (Accs[i]->getNum()==accnum)
	     m=i;
	  else
		 i++;
	 }
     return m;
	}
int FindAccountbyName(string name)
	{int i=0,m=-1;
	 int n=Accs.size();
     while ((i<n) && (m<0))
	 {if (Accs[i]->getName()==name)
	     m=i;
	  else i++;}
     return m;
}
void DisplayAllAccounts()
{int n=Accs.size();
 for (int i=0;i<n;i++)
   Accs[i]->showone();}
void OpenAccount()
{string name;
 int accnum;
 char t;
 double OpeningBalance;
cout<<"Enter The number of customer to open acount for  her/his\n";
 cin>>accnum;
 cout<<"Enter The name of customer\n";
 cin>>name;
 cout<<"Enter the start acount balance\n";
 cin>>OpeningBalance;
 cout<<"Enter account type (p/personal) OR (c/company): ";
 cin>>t;
 Accs.push_back(new Account(accnum,name,OpeningBalance,t));
 Accs.checktype(t,OpeningBalance);
 
}

void CloseAccount()
{	int i;	
	int accnum;
	char c;
	string name;
 
	cout<<"Enter number:";
	 cin>>accnum;
	 i = FindAccountbyNumber(accnum);
	
	cout<<"Enter name:";
	 cin>>name;
	 i = FindAccountbyName(name);
	if (i != -1)
//ÇÎÊÈÇÑ åá ÇáãÓÊÎã ÚáÇ íÑí ÇÛáÇÞ ÇáÓÇÈ Çã Çäå Õá ÈÇáÎØÃ
	{cout<<"\nyou are going to close "<<name<<" acount\n";
	cout<<"do you want to complet this procces\n";
	cout<<"     O or o for OK\n     c or C for cancle\n" ;
	cin>>c;
	if ((c=='O') || (c=='o'))
	{
		vector<Account *>::iterator p = Accs.begin();
		p +=i;
		delete Accs[i];
		Accs.erase(p,p+1);
}}}
void add_SO()
{int i;	
 int accnum;
 string name,n;
// char c;
 double d,a; 
	 
	cout<<"Enter number:";
	 cin>>accnum;
	 i = FindAccountbyNumber(accnum);
	
	cout<<"Enter name:";
	 cin>>name;
	 i = FindAccountbyName(name);
	if (i != -1)
	{cout<<"Enter the day of the month which it is paid:";
	 cin>>d;
	 cout<<"Enter the amount of the standing order:";
	 cin>>a;
	 Accs[i]->addSO(d,a,n);}
}
void deletSO()
{int i;	
 int accnum;
 string name,n;
 //char c;
 double d,a; 
	cout<<"Enter number:";
	 cin>>accnum;
	 i = FindAccountbyNumber(accnum);
	cout<<"Enter name:";
	 cin>>name;
	 i = FindAccountbyName(name);
	if (i != -1)
	{cout<<"Enter the amount of the standing order to be sure:";
	 cin>>a;
	 cout<<"Enter the day of the standing order to be sure:";
	 cin>>d;
	 Accs[i]->closeSO(d,a);}
}
void process_all_SO()
{int n=Accs.size();
 for (int i=0;i<n;i++)
   Accs[i]->procSO();
}
void Do_Zakat()
{
	int i;	
	int accnum;
	string name;
	//char c;
	SYSTEMTIME st;
    GetSystemTime(&st);
	double zakatAmount; 
	cout<<"Enter number:";
	 cin>>accnum;
	 i = FindAccountbyNumber(accnum);
	cout<<"Enter name:";
	 cin>>name;
	 i = FindAccountbyName(name);
	if (i != -1)
	{
	 zakatAmount = Accs[i]->zakat();
	 Accs[i]->withdraw(zakatAmount);
     ZakatAccount.deposit(zakatAmount);
	 Accs[i]->Trans.push_back(new Transactions('z',zakatAmount,st.wHour,st.wMinute));}
}
void Withdraw()
{
	int i;	
	int accnum;
	string name;
	//char c;
    SYSTEMTIME st;
    GetSystemTime(&st);
	double amount, Newbalance; 
	cout<<"Enter number:";
	 cin>>accnum;
	 i = FindAccountbyNumber(accnum);
	cout<<"Enter name:";
	 cin>>name;
	 i = FindAccountbyName(name);
	cout<<"Enter the amount to withdraw it:\n";
	cin>>amount;
	if (i != -1)
	{Accs[i]->withdraw(amount);
	 Newbalance = Accs[i]->getbalance();
	 Accs[i]->Trans.push_back(new Transactions('w',amount,st.wHour,st.wMinute));

	}}
void Deposit()
	{int i;	
	int accnum;
	string name;
//	char c;
	SYSTEMTIME st;
    GetSystemTime(&st);
	double amount, Newbalance; 
	cout<<"Enter number:";
	 cin>>accnum;
	 i=FindAccountbyNumber(accnum);
	cout<<"Enter name:";
	 cin>>name;
	 i = FindAccountbyName(name);
	cout<<"Enter the amount to deposit it:\n";
	cin>>amount;
	if (i != -1)
	{Accs[i]->deposit(amount);

	 Newbalance = Accs[i]->getbalance();
	 Accs[i]->Trans.push_back(new Transactions('d',amount,st.wHour,st.wMinute));
	}}
void ShowAccount()
{
	int i;	
	int accnum;
	string name;
//	char c;
	cout<<"Enter number:";
	 cin>>accnum;
	 i = FindAccountbyNumber(accnum);
	cout<<"Enter name:";
	 cin>>name;
	 i = FindAccountbyName(name);
	if (i != -1)
	{Accs[i]->showone();
	 }}
void ShowTrans()
{
	int i;	
	int accnum;
	string name;
//char c;
	cout<<"Enter number:";
	 cin>>accnum;
	 i = FindAccountbyNumber(accnum);
	cout<<"Enter name:";
	 cin>>name;
	 i = FindAccountbyName(name);
	if (i != -1)
	{cout<<"\nALL Transactions of this account is:\n";
	 Accs[i]->showTrans();
	 }}
};
//////////////////////////////////////////////////////////
void  choice()
{
cout<<"_________________\n";
cout<<"Enter a or A to add new acount\n";
cout<<"Enter w or W to withdrawal from one acount\n";
cout<<"Enter d or D to depositing to one acount\n";
cout<<"Enter c or C to close an acount\n";
cout<<"Enter o or O to add a standing order to one acount\n";
cout<<"Enter r or R to remove a standing order from one acount\n";
cout<<"Enter i or I to processing standing orders for all accounts\n";
cout<<"Enter p or P to show all transactions for one acount\n";
cout<<"Enter s or S to show all acounts\n";
cout<<"Enter h or H to show one acount\n";
cout<<"Enter z or Z to do Zakat calculation for an acount\n";
cout<<"Enter q or Q to quit the program\n";
cout<<"_________________\n";
}
//////////////////////////////////////////////////////////
main()
{
 char c;
 choice();
 cin>>c;
 Bank b;
 do{
 switch (c)
 {case 'w':
  case 'W':
    b.Withdraw();
	choice();
    cin>>c;
	break;
  case 'd':
  case 'D':
    b.Deposit();
	choice();
    cin>>c;
    break;
  case 'a':
  case 'A':
    b.OpenAccount();
	choice();
    cin>>c;
	break;
  case 'o':
  case 'O':
    b.add_SO();
	choice();
    cin>>c;
	break;
  case 'r':
  case 'R':
    b.deletSO();
	choice();
    cin>>c;
	break;
  case 'i':
  case 'I':
    b.process_all_SO();
	choice();
    cin>>c;
	break;
  case 's':
  case 'S':
     b.DisplayAllAccounts();
	 choice();
     cin>>c;
	 break;
  case 'p':
  case 'P':
	b.ShowTrans();
	choice();
    cin>>c;
	break;
  case 'h':
  case 'H':
    b.ShowAccount();
	choice();
    cin>>c;
	break;
  case 'z':
  case 'Z':
    b.Do_Zakat();
	choice();
    cin>>c;
	break;
  case 'c':
  case 'C':
    b.CloseAccount();
    choice();
    cin>>c;
	break;
  };
 }while ((c!='q') && (c!='Q'));
 return 0;
}

that is the code
here is the error:

--------------------Configuration: sa - Win32 Debug--------------------
Compiling...
sa.cpp
C:\Documents and Settings\A\My Documents\sa.cpp(96) : error C2039: 'check_type' : is not a member of 'vector<class customer *,class std::allocator<class customer *> >'
Error executing cl.exe.

sa.exe - 1 error(s), 0 warning(s

Recommended Answers

All 12 Replies

Here's your problem:

cust.check_type(type,balance);

You're calling that method on a vector?

would you show me the correct way please

by fault

please post the way of calling ;) :o

>please post the way of calling
Please read a book, or stop using libraries and features that are so far beyond you. cust is a vector of pointers to customer. You're trying to use a member function of the customer class as if it were a member function of the vector class. You need to 1) pick which of the multiple customer pointers in the vector that you want and 2) dereference the pointer so that you can call the member function of the object to which it points. For example:

cust[i]->check_type(type,balance);

If you're having trouble with concepts such as levels of indirection and aggregates, you shouldn't be using them in a live program.

thanks when i make it as you said 1 another error appear that check_type function doesnot take 2 parameter
>>>>

If you're having trouble with concepts such as levels of indirection and aggregates, you shouldn't be using them in a live program.

i have to use it because the prophessor asked to

thanks agian

>when i make it as you said 1 another error appear that
>check_type function doesnot take 2 parameter
So it seems. Here's your function definition. Notice the complete lack of parameters which means that it takes no parameters.

void check_type(){

>i have to use it because the prophessor asked to
While I applaud his desire to teach the standard container classes, it seems from your posts like he's moving the class far too quickly.

Notice the complete lack of parameters which means that it takes no parameters.

In C++, yes. In C, no. :)

While I applaud his desire to teach the standard container classes, it seems from your posts like he's moving the class far too quickly.

as if you were there

>In C++, yes. In C, no.
Bzzt! I'm sorry, but that's incorrect. Thank you for playing. ;) In a function definition, an empty parameter list means no arguments in both C and C++. This feature hasn't yet been removed from the C language definition, though it was deprecated because the corresponding declaration was dangerous and too many people were confused with the difference between a declaration and a definition...as you've conveniently shown. :D

Granted, there are subtle differences in some implementations between

void foo()
{
}

and

void foo ( void )
{
}

For example, one would produce an error when called with arguments, but the other would not. But that's implementation-dependent, and in the language definition, both are identical.

>as if you were there
Well, I was assuming the best of you. If you don't like that, I can assume that your teacher is competent and moves the class at a comfortable pace, but you're a lazy slacker who doesn't pay attention in class, then runs around looking for a cheat after realizing that he's completely ignorant of the skills required to get a passing grade. We get a lot of people like that, and you should be thrilled that I originally treated you like you weren't one of them.

Well, I was assuming the best of you. If you don't like that, I can assume that your teacher is competent and moves the class at a comfortable pace, but you're a lazy slacker who doesn't pay attention in class, then runs around looking for a cheat after realizing that he's completely ignorant of the skills required to get a passing grade. We get a lot of people like that, and you should be thrilled that I originally treated you like you weren't one of them.

wait there is amissunderstood when i said as if you were there i mean that you are said the right thing as if you have seen how she explain bleave me when i say that she moves as herrry as she can to finish in the time cuase she has absent at the begining of the semester so we were late that why she moves so quickly i hope you know now what i mean at the first
finally thanks for your good thinking of me

wait there is amissunderstood when i said as if you were there i mean that you are said the right thing as if you have seen how she explain bleave me when i say that she moves as herrry as she can to finish in the time cuase she has absent at the begining of the semester so we were late that why she moves so quickly i hope you know now what i mean at the first
finally thanks for your good thinking of me

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


class customer{
    private:
    char type;
    double balance;

public:
	customer(char t, double bal):type(t),balance(bal)
	{
	}
	void check_type(){

    if(type=='p'){
        if (balance<1000) {
            balance=balance-2;
        }
        else
            if (balance<1000) {
                balance=balance-5;
            }
        }
    }
};

class Transactions{
private:
    char type;
    double amount;
    int houre;
    int minute;
public:
    Transactions(char t,double a,int h,int m):type(t),amount(a),houre(h),minute(m)
    {}
    void print()
    {
        if (type=='w')
            cout<<"-Withdrawal("<<amount<<")...AT:"<<houre<<":"<<minute<<"\n";
        if (type=='d')
            cout<<"-Deposition("<<amount<<")...AT:"<<houre<<":"<<minute<<"\n";
        if (type=='z')
            cout<<"-Zakat("<<amount<<")...AT:"<<houre<<":"<<minute<<"\n";
        if (type=='s')
            cout<<"-Standing Order("<<amount<<")...AT:"<<houre<<":"<<minute<<"\n";
    }
};
////////////////////////////////////////////////////////////
class Standing_orders
{
private:
    int day;
    double amount;
    string name;
public:
    Standing_orders(int d,double a,string n):day(d),amount(a),name(n)
    {}
    int getday(){
        return day;
    }
    double getamount(){
        return amount;
    }
    string getname(){
        return name;
    }
};
////////////////////////////////////////////////////////////
class Account
{
private:
    string name;
    int AccNum;
    double balance;
    char type;
    vector<Standing_orders *> SO;

public:
    vector<customer *> cust;
    vector<Transactions *> Trans;
    Account():AccNum(0),name(""),balance(0)
    {}

    Account(int n,string na, double b,char t):
                     name(na),AccNum(n),balance(b),type(t)
                     {}
//check_type
    void checktype(char type,double balance )
    {

        if(type=='p'){
            if (balance<1000) {
                balance=balance-2;
            }
            else
            if (balance<1000) {
                balance=balance-5;
            }
        }
		//cust.back()->check_type();//(type,balance);
    }
    void addSO(int day,double amount,string name)
    {
        SO.push_back(new Standing_orders(day,amount,name));
    }
    void closeSO(int day,double amount)
    {
        int i=0,m=-1;
        int n=SO.size();
        while ((i<n) && (m<0))
        {
            if ((SO[i]->getday()==day) && (SO[i]->getamount()==amount))
                m=i;
            else
                i++;
        }
        vector<Standing_orders *>::iterator p = SO.begin();
        p +=i;
        delete SO[i];
        SO.erase(p,p+1);
    }
    void procSO()
    {
        int n=SO.size();
        SYSTEMTIME st;
        GetSystemTime(&st);
        int day=st.wDay;
        for (int i=0;i<n;i++)
            if (SO[i]->getday()==day)
            {
                Trans.push_back(new Transactions('s',SO[i]->getamount(),st.wHour,st.wMinute));
                balance=balance-SO[i]->getamount();
            }
    }

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

    string getName()
    {
        return name;
    }

    void setNum(int n)
    {
        AccNum=n;
    }

    int getNum()
    {
        return AccNum;
    }

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

    double getbalance()
    {
        return balance;
    }
    void withdraw(double amount)
    {
        balance=balance-amount;
    }

    void deposit(double amount)
    {
        balance=balance+amount;
    }
    double zakat()
    {
        double z;
        if (balance>=4000)
            z=(balance*2.5)/100;
        else
            z=0;
            if (z==0)
                cout<<"This account dont reached the Zakat amount\n";
            return z;
    }
    void showone()
    {
        cout<<AccNum<<"-"<<name<<"......"<<balance<<"\n";
    }
    void showTrans()
    {
        int n=Trans.size();
        for (int j=0;j<n;j++)
            Trans[j]->print();
     }
};
////////////////////////////////////////////////////////////
class Bank{
private:
    Account ZakatAccount;
    vector<Account *> Accs;

public:
    int FindAccountbyNumber(int accnum)
    {
        int m=-1,i=0;
        int n=Accs.size();
        while ((i<n) && (m<0))
        {
            if (Accs[i]->getNum()==accnum)
                m=i;
            else
                i++;
         }
         return m;
    }

    int FindAccountbyName(string name)
    {
        int i=0,m=-1;
        int n=Accs.size();
        while ((i<n) && (m<0))
        {
            if (Accs[i]->getName()==name)
                m=i;
            else
                i++;
        }
        return m;
    }

    void DisplayAllAccounts()
    {
        int n=Accs.size();
        for (int i=0;i<n;i++)
            Accs[i]->showone();
    }

    void OpenAccount()
    {
        string name;
        int accnum;
        char t;
        double OpeningBalance;

        cout<<"Enter The number of customer to open acount for  her/his\n";
        cin>>accnum;
        cout<<"Enter The name of customer\n";
        cin>>name;
        cout<<"Enter the start acount balance\n";
        cin>>OpeningBalance;
        cout<<"Enter account type (p/personal) OR (c/company): ";
        cin>>t;
        
		Accs.push_back(new Account(accnum,name,OpeningBalance,t));
		Accs.back()->checktype(t,OpeningBalance);
    }

    void CloseAccount()
    {
        int i;
        int accnum;
        char c;
        string name;

        cout<<"Enter number:";
        cin>>accnum;
        i = FindAccountbyNumber(accnum);

        cout<<"Enter name:";
        cin>>name;
        i = FindAccountbyName(name);
        if (i != -1)
        {
            cout<<"\nyou are going to close "<<name<<" acount\n";
            cout<<"do you want to complet this procces\n";
            cout<<"     O or o for OK\n     c or C for cancle\n" ;
            cin>>c;
            if ((c=='O') || (c=='o'))
            {
                vector<Account *>::iterator p = Accs.begin();
                p +=i;
                delete Accs[i];
                Accs.erase(p,p+1);
            }
        }
    }

    void add_SO()
    {
        int i;
         int accnum;
         string name,n;
        // char c;
         double d,a;

        cout<<"Enter number:";
        cin>>accnum;
        i = FindAccountbyNumber(accnum);

        cout<<"Enter name:";
        cin>>name;
        i = FindAccountbyName(name);
        if (i != -1)
        {
            cout<<"Enter the day of the month which it is paid:";
            cin>>d;
            cout<<"Enter the amount of the standing order:";
            cin>>a;
            Accs[i]->addSO(d,a,n);
        }
    }

    void deletSO()
    {
        int i;
        int accnum;
        string name,n;
        //char c;
        double d,a;

        cout<<"Enter number:";
        cin>>accnum;
        i = FindAccountbyNumber(accnum);
        cout<<"Enter name:";
        cin>>name;
        i = FindAccountbyName(name);
        if (i != -1)
        {
            cout<<"Enter the amount of the standing order to be sure:";
            cin>>a;
            cout<<"Enter the day of the standing order to be sure:";
            cin>>d;
            Accs[i]->closeSO(d,a);
         }
    }

    void process_all_SO()
    {
        int n=Accs.size();
        for (int i=0;i<n;i++)
            Accs[i]->procSO();
    }

    void Do_Zakat()
    {
        int i;
        int accnum;
        string name;
        //char c;
        SYSTEMTIME st;

        GetSystemTime(&st);
        double zakatAmount;
        cout<<"Enter number:";
        cin>>accnum;
        i = FindAccountbyNumber(accnum);
        cout<<"Enter name:";
        cin>>name;
        i = FindAccountbyName(name);
        if (i != -1)
        {
            zakatAmount = Accs[i]->zakat();
            Accs[i]->withdraw(zakatAmount);
            ZakatAccount.deposit(zakatAmount);
            Accs[i]->Trans.push_back(new Transactions('z',zakatAmount,st.wHour,st.wMinute));
        }
    }

    void Withdraw()
    {
        int i;
        int accnum;
        string name;
        //char c;
        SYSTEMTIME st;

        GetSystemTime(&st);
        double amount, Newbalance;
        cout<<"Enter number:";
        cin>>accnum;
        i = FindAccountbyNumber(accnum);
        cout<<"Enter name:";
        cin>>name;
        i = FindAccountbyName(name);
        cout<<"Enter the amount to withdraw it:\n";
        cin>>amount;
        if (i != -1)
        {
            Accs[i]->withdraw(amount);
            Newbalance = Accs[i]->getbalance();
            Accs[i]->Trans.push_back(new Transactions('w',amount,st.wHour,st.wMinute));
        }
    }

    void Deposit()
    {
        int i;
        int accnum;
        string name;
    //  char c;
        SYSTEMTIME st;

        GetSystemTime(&st);
        double amount, Newbalance;
        cout<<"Enter number:";
        cin>>accnum;
        i=FindAccountbyNumber(accnum);
        cout<<"Enter name:";
        cin>>name;
        i = FindAccountbyName(name);
        cout<<"Enter the amount to deposit it:\n";
        cin>>amount;
        if (i != -1)
        {
            Accs[i]->deposit(amount);

            Newbalance = Accs[i]->getbalance();
            Accs[i]->Trans.push_back(new Transactions('d',amount,st.wHour,st.wMinute));
        }
    }

    void ShowAccount()
    {
        int i;
        int accnum;
        string name;
    //  char c;

        cout<<"Enter number:";
        cin>>accnum;
        i = FindAccountbyNumber(accnum);
        cout<<"Enter name:";
        cin>>name;
        i = FindAccountbyName(name);
        if (i != -1)
        {
            Accs[i]->showone();
        }
     }

    void ShowTrans()
    {
        int i;
        int accnum;
        string name;
        //char c;

        cout<<"Enter number:";
        cin>>accnum;
        i = FindAccountbyNumber(accnum);
        cout<<"Enter name:";
        cin>>name;
        i = FindAccountbyName(name);
        if (i != -1)
        {
            cout<<"\nALL Transactions of this account is:\n";
            Accs[i]->showTrans();
        }
    }
};
//////////////////////////////////////////////////////////
void  choice()
{
    cout<<"_________________\n";
    cout<<"Enter a or A to add new acount\n";
    cout<<"Enter w or W to withdrawal from one acount\n";
    cout<<"Enter d or D to depositing to one acount\n";
    cout<<"Enter c or C to close an acount\n";
    cout<<"Enter o or O to add a standing order to one acount\n";
    cout<<"Enter r or R to remove a standing order from one acount\n";
    cout<<"Enter i or I to processing standing orders for all accounts\n";
    cout<<"Enter p or P to show all transactions for one acount\n";
    cout<<"Enter s or S to show all acounts\n";
    cout<<"Enter h or H to show one acount\n";
    cout<<"Enter z or Z to do Zakat calculation for an acount\n";
    cout<<"Enter q or Q to quit the program\n";
    cout<<"_________________\n";
}
//////////////////////////////////////////////////////////
main()
{
    char c;

    choice();
    cin>>c;

    Bank b;
    do{
        switch (c)
        {
            case 'w':
            case 'W':
                b.Withdraw();
                break;
            case 'd':
            case 'D':
                b.Deposit();
                break;
            case 'a':
            case 'A':
                b.OpenAccount();
                break;
            case 'o':
            case 'O':
                b.add_SO();
                break;
            case 'r':
            case 'R':
                b.deletSO();
                break;
            case 'i':
            case 'I':
                b.process_all_SO();
                break;
            case 's':
            case 'S':
                b.DisplayAllAccounts();
                break;
            case 'p':
            case 'P':
                b.ShowTrans();
                break;
            case 'h':
            case 'H':
                b.ShowAccount();
                break;
            case 'z':
            case 'Z':
                b.Do_Zakat();
                break;
            case 'c':
            case 'C':
                b.CloseAccount();
                break;
        };
		choice();
		cin>>c;
    } while ((c!='q') && (c!='Q'));
    return 0;
}

Check it out if it does the job.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.