title: First-chance exception within my code
body: <p>I'm creating an ice skating program for my class and I'm running into an error messages during run-time.  It occurs when the compiler tries to add the performance and technical scores in the Judge function.  Any help would be appreciated and if any clarification is needed, please let me know!</p>
  
  <p><strong>Edit:  The error messages are</strong> 
  <strong>"<em>First-chance exception</em> at 0x00FE4686 in IceSkating1.exe: 0xC0000005: Access violation reading location 0xCDCDCDD5." and "<em>Unhandled exception</em> at 0x00FE4686 in IceSkating1.exe: 0xC0000005: Access violation reading location 0xCDCDCDD5."</strong></p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;iomanip&gt;
  using namespace std;
  
  typedef int *intptr;
  
  class Judge
  {
  private:
      int performance, technical, total = 0;
  
  public:
      void SetPerformance(int a) { performance = a; }
      void SetTechnical(int a) { technical = a; }
      void SetTotal() { total = performance + technical;} //EXCEPTION OCCURS HERE
      int GetTotal() { return total; }
  };
  
  class Skater
  {
  private:
      int ID;
      Judge* judges;
      int *ranks;
  
  public:
      void SetID()
      {
          int t;
          cout &lt;&lt; "Please enter skater ID: ";
          cin &gt;&gt; t;
          ID = t;
      }
  
      int GetID()
      {
          return ID;
       }
  
      void Judges(int qnty)
      {
          int p, t;
          judges = new Judge[qnty];
  
  
          for (int count = 0; count &lt; qnty; count++)
          {
              cout &lt;&lt; "Please enter the peformance score from judge " &lt;&lt; count + 1 &lt;&lt; ":";
              cin &gt;&gt; p;
              while ((p &gt; 6) || (p &lt; 0))
          {
              cout &lt;&lt; "Invalid score.  Please enter a value between 0 - 6. \n";
              cin &gt;&gt; p;
          }
  
          judges[qnty].SetPerformance(p);
  
  
          cout &lt;&lt; "Please enter the technical score from judge " &lt;&lt; count + 1 &lt;&lt; ":";
          cin &gt;&gt; t;
  
          while ((t &gt; 6) || (t &lt; 0))
          {
              cout &lt;&lt; "Invalid score.  Please enter a value between 0 - 6. \n";
              cin &gt;&gt; t;
          }
  
          judges[qnty].SetTechnical(t);
  
      }
  }
  
  int GetJudgeTotal(int judgeqnty)
  {
      return judges[judgeqnty].GetTotal();
  }
  
  void SetRank(int judgeqnty, int rank)
  {
      ranks = new int[judgeqnty];
      rank = ranks[judgeqnty];
  }
  
  int GetRank(int judgeqnty)
  {
      return ranks[judgeqnty];
  }
  };
  
  
  int main()
  {
  Skater* s;
  int skaterqnty, judgeqnty;
  
  cout &lt;&lt; "Please enter number of contestants: ";
  cin &gt;&gt; skaterqnty;
  
  while ((skaterqnty &gt; 24) || (skaterqnty &lt; 0))
  {
      cout &lt;&lt; "Please enter a valid amount. \n";
      cin &gt;&gt; skaterqnty;
  }
  
  s = new Skater[skaterqnty];
  
  for (int count = 0; count &lt; skaterqnty; count++) {
      s[count].SetID();
  }
  
  
  cout &lt;&lt; "Please enter odd number of judges: ";
  cin &gt;&gt; judgeqnty;
  if ((judgeqnty % 2) == 0 || (judgeqnty &gt; 11))
  {
      cout &lt;&lt; "Please enter valid number of judges. \n";
      cin &gt;&gt; judgeqnty;
  }
  
  for (int count = 0; count &lt; skaterqnty; count++)
  {
      cout &lt;&lt; "Please enter scores for skater " &lt;&lt; s[count].GetID() &lt;&lt; ": \n";
      s[skaterqnty].Judges(judgeqnty);
  }
  
  cout &lt;&lt; s[0].GetJudgeTotal(0);
  
  /*int jTotals[judgeqnty][skaterqnty];
  
  for (int column = 0; column &lt; skaterqnty; column++){
  for (int row = 0; row &lt; judgeqnty; row++){
  jTotals[row][column] = s[column].JudgeTotal(judgeqnty);
  }
  }*/
  
  cout &lt;&lt; "---Beginning rank sort---\n";
  for (int m = 0; m &lt; judgeqnty; m++) {
  int _rank = 1; cout &lt;&lt; "---First level of loop\n";
  for (int n = 0; n &lt; skaterqnty; n++) { cout &lt;&lt; "---Second level \n";
  for (int p = 0; p &lt; skaterqnty; p++) { cout &lt;&lt; "---Third level \n";
  if (s[n].GetJudgeTotal(m) &lt; s[p].GetJudgeTotal(m))
  {
  _rank++;
  cout &lt;&lt; "Control statement completed\n";
  }
  } cout &lt;&lt; "End third level\n";
  s[n].SetRank(m, _rank); cout &lt;&lt; "End second level\n";
  } cout &lt;&lt; "First level completed. \n";
  }
  
  for (int a = 0; a &lt; skaterqnty; a++){
      for (int b = 0; b &lt; judgeqnty; b++)
      {
          cout &lt;&lt; "Current Ranking:\nSkater " &lt;&lt; s[a].GetID() &lt;&lt; ":\t" &lt;&lt; s[a].GetRank(b) &lt;&lt; "\t";
      }
  }
  
  cout &lt;&lt; "\nDONE.";
  
  }
  </code></pre>