if else value returning problem

#include <iostream>

using namespace std;

int score;

int main()
{
int courseScore;

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

cout << "Line 4: Enter course score: ";
cin >> score;
cout << endl << "Line 6: Course score is "
<< score << endl;


{

cout << "Line 7: Your grade for the course is ";

if (score >= 90)
return 'A';
else if (score >= 80)
return 'B';
else if (score >= 70)
return 'C';
else if (score >= 60)
return 'D';
else
return 'F';

}

}


After putting in the input (say you put int 90) the output doesn't display the grade it just displays ("your grade for the course is " without the letter grade I wanted it to post) any help is appreciated!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <iostream>

using namespace std;

int score;

int main()
{
    int courseScore = 0;

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

    cout << "Line 4: Enter course score: ";
    cin >> score;
    cout << endl << "Line 6: Course score is "
         << score << endl;


    {

        cout << "Line 7: Your grade for the course is ";

        if (score >= 90)
            cout << 'A' << endl;
        else if (score >= 80)
            cout << 'B' << endl;
        else if (score >= 70)
            cout << 'C' << endl;
        else if (score >= 60)
            cout << 'D' << endl;
        else
            cout << 'F' << endl;

    }

}

Change the returns to couts
Thanks for the help! That answers my question.
it sounds like you're trying to use a call-by-value function

http://tinypaste.com/f61baa
Yes, that was actually what I was going for throstur. Thank you. Can you explain what I was missing and in this program and what the functions are of the missing parts please? many thanks!

Topic archived. No new replies allowed.