title: c++ Bus Error (core dumped)
body: <p>I successfully compiled following codes, but when I tried to run the codes, a "Bus error (core dumped)" occurred every time I  finished my first input of "cin >> instruct >> name >> Bal". I searched online about the bus error, but I still couldn't find my error. Please help me with this, thanks a lot !! </p>
  
  <pre><code>  // Bank.h
       1 #ifndef BANK_H
       2 #define BANK_H
       3 using namespace std;
       4 
       5 class BankAccount{
       6     private:
       7     string _name;
       8     double _balance;
       9 
       10     public:
       11     BankAccount(string, double);
       12     string getName();
       13     void setName(string);
       14     double getBalance();
       15     void setBalance(double);
       16     void Withdraw(double);
       17     void Deposite(double);
       18     void interest(int, int);
       19 
       20 };
       21 #endif
  
   //Bank.cpp
   1 #include&lt;iostream&gt;
   2 #include&lt;string&gt;
   3 #include "Bank.h"
   4 using namespace std;
   5 
   6 BankAccount::BankAccount(string name, double balance):_name(name),
   7 _balance(balance){}
   8 
   9 string BankAccount::getName(){ return _name;}
   10 
   11 double BankAccount::getBalance(){ return _balance;}
   12 
   13 void BankAccount::setName(string name){
   14     _name = name;
   15     return;
   16 }
   17 
   18 void BankAccount::setBalance(double balance){
   19     _balance = balance;
   20     return;
   21 }
   22 
   23 void BankAccount::Withdraw(double balance)
   24 {
   25 
   26     _balance = _balance - balance;
   27     return;
   28 }
   29 
   30 void BankAccount::Deposite(double balance)
   31 {
   32 
   33     _balance = _balance + balance;
   34     return;
   35 }
   36 
   37 void BankAccount::interest(int interestRate, int M)
   38 {
   39     double interest;
   40 
   41     interest = _balance*(interestRate/1200*1.0)*M;
   42     _balance  = _balance + interest;
   43 
   44     return;
   45 }
  
  
    //BankMain.cpp
    1 #include&lt;iostream&gt;
    2 #include&lt;string&gt;
    3 #include "Bank.h"
    4 using namespace std;
    5 
    6 int main()
    7 {
    8     int x, p, check=1, i=0, j;
    9     double Bal;
   10     BankAccount* Account[100];
   11     string name;
   12     string instruct;
   13 
   14     cin &gt;&gt; x &gt;&gt; p;
   15 
   16     while(check)
   17     {
   18         cin &gt;&gt; instruct &gt;&gt; name &gt;&gt; Bal;
   19 
   20         if(instruct == "Create")
   21         {
   22             Account[i]-&gt;setName(name);
   23             Account[i]-&gt;setBalance(Bal);
   24             Account[i]-&gt;interest(x, p);
   25             i++;
   26         }
   27         else
   28         {
   29             if(instruct == "Withdraw")
   30             {
   31                 for(j=0; j&lt;i;j++)
   32                 {
   33                     if(Account[j]-&gt;getName() == name)
   34                         break;
   35                         }
   36                         Account[j]-&gt;Withdraw(Bal);
   37 
   38             }
   39 
   40             if(instruct == "Deposite")
   41             {
   42                 for(j=0; j&lt;i; j++)
   43                 {
   44                     if(Account[j]-&gt;getName() == name)
   45                         break;
   46                 }
   47                 Account[j]-&gt;Deposite(Bal);
   48             }
   49         }
   50 
   51         if(instruct == "0")
   52             check = 0;
   53     }
   54 
   55     cout &lt;&lt; i;
   56     for(j=0; j&lt;i; j++)
   57     {
   58        cout &lt;&lt; Account[j]-&gt;getName() &lt;&lt; " " &lt;&lt; Account[j]-&gt;getBalance();
   59         cout &lt;&lt; endl;
   60     }
   61 
   62     return 0;
   63 }
  </code></pre>