title: C++ Calculate Grade Function
body: <p>I am having a semantic error. I have changed my code over and over and cannot figure out what is causing my code not to output the letter grade correctly. Can anyone help? </p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;conio.h&gt;
  
  using namespace std;
  
  int getScore(int&amp; score);
  int calculateGrade(int cScore);
  
  int main()
  {
      int score;
      int cScore;
  
      cout &lt;&lt; "Based on the course score, \n this program computes the course";
      cout &lt;&lt; " grade." &lt;&lt; endl;
  
      getScore(score);
  
      calculateGrade(cScore);
  
      cout &lt;&lt; "Your grade for the course is: " &lt;&lt; static_cast&lt;char&gt;(cScore);
      cout &lt;&lt; endl;
  
      _getch();
      return 0;
  }
  
  int getScore(int&amp; score)
  {
      cout &lt;&lt; "Enter the course score: ";
      cin &gt;&gt; score;
      cout &lt;&lt; "Course score is: " &lt;&lt; score &lt;&lt; endl;
      return score;
  }
  
  int calculateGrade(int cScore)
  {
  
      if (cScore &gt;= 90)
          cScore = 65;
      if ((cScore &gt;= 80) &amp;&amp; (cScore &lt; 90))
          cScore = 66;
      if ((cScore &gt;= 70) &amp;&amp; (cScore &lt; 80))
          cScore = 67;
      if ((cScore &gt;= 60) &amp;&amp; (cScore &lt; 70))
          cScore = 68;
      if (cScore &lt; 60)
          cScore = 70;
  
      return cScore;
  
  }
  </code></pre>
  
  <p>Am I using the static_cast wrong? I have flipped through my entire book and cannot find any answers. Is there an error with my parameters? I am not sure that I entirely understand how parameters work yet. I have read a lot on them but I feel as if I'm still not using them correctly sometimes. Please help me find the problem with my calculateGrade function.</p>