Calculate Grade

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • blamp
    New Member
    • Oct 2008
    • 4

    Calculate Grade

    I have completed most of the program I just cant get the letter grade to print from the void printGrade function.The output of the program should be:

    Line 1: Based on the course score, this program computes the course grade.
    Line 4: Enter course score:_

    Line 6: Course score is:_
    Line 7: Your grade for ths course is_

    here is the program:

    #include <iostream>
    using namespace std;

    int getScore(int& score);
    void printGrade(int cScore);

    int main()
    {
    int cScore;
    int score;

    cout << "Line 1: Based on the course score, \n"
    << " this program computes the "
    << "course grade." <<endl;

    cScore = getScore(score) ;
    printGrade(cSco re);

    }

    int getScore(int& score)
    {
    cout << "Line 4: Enter course score: ";
    cin >> score;
    cout << endl << "Line 6: Course score is "
    << score << endl;

    system("PAUSE") ;
    return score;
    }

    void printGrade(int cScore)
    {
    cout << "Line 7: Your grade for the course is ";

    if (cScore >=90)
    cout << "A." << endl;
    else if (cScore >= 80)
    cout << "B." << endl;
    else if (cScore >= 70)
    cout << "C." << endl;
    else if (cScore >= 60)
    cout << "D." << endl;
    else
    cout << "F." << endl;

    }



    thanks for the help in advance
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    What does that function print instead? It should print something ...

    kind regards,

    Jos

    Comment

    • blamp
      New Member
      • Oct 2008
      • 4

      #3
      Nothing comes up, it's suppose to print the letter grade that goes with the course score.

      Comment

      • JosAH
        Recognized Expert MVP
        • Mar 2007
        • 11453

        #4
        Remove these lines from that other function:

        Code:
        system("PAUSE"); 
        return score;
        kind regards,

        Jos

        Comment

        Working...