title: Trouble outputting letter grade
body: <p>Currently i have achieved all goals for this program except outputting my letter graded average. Right now it always outputs a 70 and not a letter grade. Does anyone see what my issue is? I know currently that its redefining my lettergrade value into a 70 after passing through the lettergrade function.</p>
  
  <pre><code>#include&lt;iostream&gt;
  #include&lt;string&gt;
  using namespace std;
  
  
  
  
  int getexams(int count)
  {
      cout &lt;&lt; "Number of exams to be entered:";
      cin &gt;&gt; count;
  
      if (count &gt; 1024)
      {
          cout &lt;&lt; "Please enter a number below 1024." &lt;&lt; endl;
          system("pause");
          return 0;
      }
      else
          return count;
  
  }
  
  int enterexams(int name[],int count, int b)
  {
  
      int numexams = count;
      for (int a = 0;a &lt; numexams;a++)
      {
          cout &lt;&lt; "Enter grades: ";
          cin &gt;&gt; name[a]; 
          b++;
      }
      return b;
  
  }
  
  
  char letter(double average, char lettergrade)
  {
      int x;
      x = average;
      if (x &gt;= 90) {
          lettergrade = 'A';
  
      }
      else if (x &gt;= 80) {
          lettergrade = 'B';
  
      }
      else if (x &gt;= 70) {
          lettergrade = 'C';
  
      }
      else if (x &gt;= 60) {
          lettergrade = 'D';
  
      }
      else {
          lettergrade = 'F';
  
      }
      return lettergrade;
  
  
  }
  void output(int count,int name[], double average, int lettergrade)
  {
      cout &lt;&lt; "Number of exams: " &lt;&lt; count &lt;&lt; endl;
      for (int a = 0;a &lt; count;a++)
          cout &lt;&lt; "Exam grades: " &lt;&lt; name[a] &lt;&lt; endl;
      cout &lt;&lt; "Average grade: " &lt;&lt; average &lt;&lt; endl;
      cout &lt;&lt; "Letter grade: " &lt;&lt; lettergrade &lt;&lt; endl;
  }
  int averagecalc(int average,int count,int name[])
  {
      int a,sum,x;
      sum = 0;
  
      for (a = 0;a &lt; count;a++)
      {
          sum += name[a];
  
      }
      average = sum / count;
      return average;
  }
  int main()
  {
      char lettergrade = 0;
      int b = 0;
      int total = 0;
      double average = 0;
      int count =0;
      count = getexams(count);
      // Number of exams
  
      int exams = count;
      const int x = exams;            // Exam Values
      int name[1024];
  
      enterexams(name,count,b);
      average = averagecalc(average,count,name);
      lettergrade = letter(average, lettergrade);
      output(count, name, average, lettergrade);
  
      system("pause");
      return 0;
  }
  </code></pre>