title: Getting the error: floating point exception
body: <p>I am a novice coder and I am currently working on the Usaco Training problems to improve my skills. This was my code for "Greedy Gift Givers". When I submit the code, I get an error that says: Execution error: Your program (`gift1') exited with signal
          #8 (floating point exception [usually caused by accessing memory
          out of bounds]). The program ran for 0.000 CPU seconds before the
          signal. It used 3504 KB of memory. "
  I have been looking through my code and trying to fix this error for a while now. Can anyone help? Please don't get angry with me as this is my first time posting, and like I said, I'm brand new to programming.</p>
  
  <pre><code>/*
  ID: ashton.1
  PROG: gift1
  LANG: C++
  */
  
  #include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include &lt;string&gt;
  
  using namespace std;
  
  int main()
  {
      ifstream fin ("gift1.in");
      ofstream fout ("gift1.out");
  
      int initial, account[10], recipients, NP;
      string names[10], giver, receiver;
  
      fin &gt;&gt; NP;
  
      for (int k = 0; k &lt; NP; k++)
      {
          fin &gt;&gt; names[k];
          account[k] = 0;
      }
  
      for (int k = 0; k &lt; NP; k++)
      {
          fin &gt;&gt; giver &gt;&gt; initial &gt;&gt; recipients;
  
          for (int y = 0; y &lt; NP; y++)
          {
              if( names[y] == giver)
                  break;
          }
          account[k] -= initial;
          account[k] += initial  % recipients;
  
          for (int y = 0; y &lt; recipients; y++)
          {
              fin &gt;&gt; receiver;
  
              for (int j = 0; j &lt; NP; j++)
              {
                  if(names[j] == receiver)
                      break;
              }
              if(recipients != 0)
              {
                  for(int x = 0; x &lt; NP; x++)
                  {
                      account[x] += (int)initial / recipients;
                  }
              }
          }
          fout &lt;&lt; names[k] &lt;&lt; " " &lt;&lt; account[k] &lt;&lt; endl;
      }
  
      return 0;
  }   
  </code></pre>