Skip to main content
0 online
theremin thereminOG 2002 ·

This won't compile... :(

#include

using namespace std;

void getScore(int& score);
char convertScoreToGrade(int cScore);

int main()
{
int courseScore;

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

getScore(courseScore);
convertScoreToGrade(int cScore);

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

return 0;

}

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

char convertScoreToGrade(int cScore)
{ if (cScore >= 90)
return 'A';
else if (cScore >= 80)
return 'B';
else if (cScore >= 70)
return 'C';
else if (cScore >= 60)
return 'D';
else
return 'F';
}

yay yayOG 2004 ·

Why doesn't it compile? What's the compiler saying?

Two reasons it won't work:
1. You don't keep the return of convertScoreToGrade() to a char variable.
2. You don't print out the returned value of convertScoreToGrade()

iwz iwz ·

yeah, the most important thing when asking for help is to post the compiler errors.

Welcome Back to eZabel

It's been a while. Here's what's new.

eZabel Lore

A complete history of our community — stats, Hall of Fame, legendary threads, and more.

View the Lore →

Everything Preserved

All 225,969 pieces of content from 2000–2014 are here — forums, messages, journals, photos, polls, and events.

💎

Gems

Spot something you love — a legendary comment, a classic thread, a great photo? Log in and click the diamond icon to mark it as a Gem. Add a note about why it's special. The best stuff surfaces on the Gems page.