Skip to main content
0 online
D
dgiaimoOG 2003

The easiest way to do this is to change printGrade so that it returns a char. Then just return the appropriate letter. For example you could use a function like this:

// Renamed printGrade to better convey
// the semantics of the function
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';
}

Now you just need to move all the printing that was in printGrade into the main function and call this function to get the letter grade.

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.