I could really use help with void-user defined, value-returning functions. here's my Instructions for my C++ program: The function printGrade in Example 6-13 is written as a void function to compute and output the course grade. The course score is passed as a parameter to the function printGrade. Rewrite the function printGrade as a value-returning function so that it computes and returns the course grade. (The course grade must be output in the function main.) Also, change the name of the function to calculateGrade.The function printGrade has been posted below for your convenience. void printGrade(int cScore){cout << "The course grade 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; } I don't understand how to program a void function. It doesn't make sense to me. Can anyone help me to finish this program? I would appreciate it.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter6: Modularity Using Functions
Section6.3: Returning Multiple Value
Problem 4E
icon
Related questions
Question

I could really use help with void-user defined, value-returning functions.

here's my Instructions for my C++ program:

The function printGrade in Example 6-13 is written as a void function to compute and output the course grade. The course score is passed as a parameter to the function printGrade. Rewrite the function printGrade as a value-returning function so that it computes and returns the course grade. (The course grade must be output in the function main.) Also, change the name of the function to calculateGrade.
The function printGrade has been posted below for your convenience.
void printGrade(int cScore)
{
cout << "The course grade 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;
}

I don't understand how to program a void function. It doesn't make sense to me. Can anyone help me to finish this program? I would appreciate it.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Types of Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning