MindTap - Cengage Learning - Microsoft Edge A https://ng.cengage.com/static/nb/ui/evo/index.html?deploymentld=57811235846758605217306036&elSBN=9781337274715&id=7109378718&snapshotld=1589550& >> CENGAGE MINDTAP Q Search this course Programming Exercise 6-19 Introduction main.cpp >- Terminal 1 //Define include-header files main.cpp:18:17: error: return-stateme nt with a value, in function returnin g 'void' [-fpermissive] return-s << "B"; 2 #include Instructions #include A-Z The function printGrade in Example main.cpp:20:12: error: “s' was not de clared in this scope return-s << "C"; </> 6-13 is written as a void function to 6 //Define namespace statements compute and output the course 7 using namespace std; main.cpp:20:17: error: return-stateme nt with a value, in function returnin g 'void' [-fpermissive] return-s << "c"; grade. The course score is passed as a 9 void calculateGrade(int cScore) parameter to the function 10 printGrade. Rewrite the function 11 //Define the void calculateGrade user-defined, value-returing function. printGrade as a value-returning function so that it computes and main.cpp:22:12: error: 's' was not de clared in this scope return-s << "D"; 12 { 13 cout <«"Your grade for the course is: "; 14 { returns the course grade. (The course main.cpp:22:17: еггог: геturn-stateme nt with a value, in function returnin g 'void' [-fpermissive] return-s << "D"; 15 if (cScore >= 90) { bango grade must be output in the function 16 return-s <« "A"; main .) Also, change the name of the } else if (cScore >= 80) { 17 function to calculateGrade . return-s << "B"; 18 main.cpp:24:12: error: s' was not de clared in this scope return-s <<"F"; 19 } else if (cScore >= 70) { The function printGrade has been 20 return-s <« "c"; 21 } else if (cScore >= 60) { posted below for your convenience. main.cpp:24:16: error: return-stateme nt with a value, in function returnin g 'void' [-fpermissive] return-s <«"F"; 22 return-s < "D"; 23 } else { 24 return-s <<"F"; void printGrade(int cScore) /bin/bash: line 4: ./a.out: No such f ile or directory 25 } { 26 } cout <« "The course grade is: "; 6:42 PM P Type here to search I'm desperately in n. MindTap - Cengag.. ProgramminExercis. 4/13/2020 MindTap - Cengage Learning - Microsoft Edge A https://ng.cengage.com/static/nb/ui/evo/index.html?deploymentld=57811235846758605217306036&elSBN=9781337274715&id=7109378718&snapshotld=1589550& >> CENGAGE MINDTAP Q Search this course Programming Exercise 6-19 Introduction main.cpp >- Terminal 17 } else if (CScore >= 80) { main.cpp:18:17: error: return-stateme nt with a value, in function returnin g 'void' [-fpermissive] return-s << "B"; 18 return-s <« "B"; Instructions } else if (cScore >= 70) { 19 A-Z 20 return-s << "c"; The function printGrade in Example } else if (cScore >= 60) { main.cpp:20:12: error: “s' was not de clared in this scope return-s << "C"; 22 return-s << "D"; </> 6-13 is written as a void function to 23 } else { compute and output the course 24 return-s <<"F"; main.cpp:20:17: error: return-stateme nt with a value, in function returnin g 'void' [-fpermissive] return-s << "C"; grade. The course score is passed as a } 25 parameter to the function 26 printGrade . Rewrite the function 27 } 28 int main() printGrade as a value-returning function so that it computes and main.cpp:22:12: error: 's' was not de clared in this scope return-s << "D"; 29 { 30 //Define the variables returns the course grade. (The course int cScore; main.cpp:22:17: еггог: геturn-stateme nt with a value, in function returnin g 'void' [-fpermissive] return-s << "D"; 31 bango grade must be output in the function 32 main .) Also, change the name of the 33 //Prompt the user to input their course score to calculate their grade. function to calculateGrade . 34 cout <<"what is is your final course score? :" << endl; main.cpp:24:12: error: s' was not de clared in this scope return-s <<"F"; 35 //Read the inputted score 36 cin >> cScore; The function printGrade has been 37 posted below for your convenience. main.cpp:24:16: error: return-stateme nt with a value, in function returnin g 'void' [-fpermissive] return-s <«"F"; 38 //Test the calculateGrade(cScore) function 39 cout <«"The grade is: " <« cscore << endl; 40 void printGrade(int cScore) return 0; 41 /bin/bash: line 4: ./a.out: No such f ile or directory { 42 } 43 cout <« "The course grade is: "; 7:01 PM P Type here to search I'm desperately in n. MindTap - Cengag.- ProgramminExercis. 14 4/13/2020

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

Sorry about that. Here's my C++ parameters:

Instructions

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;
}

Here's what I got so far:

//Define include-header files
#include <iostream>
#include <string.h>


//Define namespace statements
using namespace std;

void calculateGrade(int cScore)

//Define the void calculateGrade user-defined, value-returing function.
{
cout <<"Your grade for the course is: ";
{
if (cScore >= 90) {
return-s << "A";
} else if (cScore >= 80) {
return-s << "B";
} else if (cScore >= 70) {
return-s << "C";
} else if (cScore >= 60) {
return-s << "D";
} else {
return-s <<"F";
}
}
}
int main()
{
//Define the variables
int cScore;

//Prompt the user to input their course score to calculate their grade.
cout <<"What is is your final course score? :" << endl;
//Read the inputted score
cin >> cScore;

//Test the calculateGrade(cScore) function
cout <<"The grade is: " << cScore << endl;

return 0;
}

As I stated eariler, Void functions confuse me. Then this program wants me to convert a void function into a value-returning function escapses me even more.

As you can see from my screen vs. my instructions, my problem in my program is my return statements. I don't understand why the complier is asking me to input an -s value after the return command, now it's asking me to declare it as a variable in this function. Can someone please help me out?

Also, I believe I may have configured my output command incorrectly when calling the void calculateGrade(int cScore) function. On line 39, am I supposed to use "cScore," all of the void function, or part of it? For example:

cout <<"The grade is: " << cScore << endl; or

cout <<"The grade is: " << calculateGrade(cScore) << endl;

or something else? Please help me! Thanks!

MindTap - Cengage Learning - Microsoft Edge
A https://ng.cengage.com/static/nb/ui/evo/index.html?deploymentld=57811235846758605217306036&elSBN=9781337274715&id=7109378718&snapshotld=1589550&
>>
CENGAGE MINDTAP
Q Search this course
Programming Exercise 6-19
Introduction
main.cpp
>- Terminal
1 //Define include-header files
main.cpp:18:17: error: return-stateme
nt with a value, in function returnin
g 'void' [-fpermissive]
return-s << "B";
2 #include <iostream>
Instructions
#include <string.h>
A-Z
The function printGrade in Example
main.cpp:20:12: error: “s' was not de
clared in this scope
return-s << "C";
</>
6-13 is written as a void function to
6 //Define namespace statements
compute and output the course
7 using namespace std;
main.cpp:20:17: error: return-stateme
nt with a value, in function returnin
g 'void' [-fpermissive]
return-s << "c";
grade. The course score is passed as a
9 void calculateGrade(int cScore)
parameter to the function
10
printGrade. Rewrite the function
11 //Define the void calculateGrade user-defined, value-returing function.
printGrade as a value-returning
function so that it computes and
main.cpp:22:12: error: 's' was not de
clared in this scope
return-s << "D";
12
{
13
cout <«"Your grade for the course is: ";
14
{
returns the course grade. (The course
main.cpp:22:17: еггог: геturn-stateme
nt with a value, in function returnin
g 'void' [-fpermissive]
return-s << "D";
15
if (cScore >= 90) {
bango
grade must be output in the function
16
return-s <« "A";
main .) Also, change the name of the
} else if (cScore >= 80) {
17
function to calculateGrade .
return-s << "B";
18
main.cpp:24:12: error: s' was not de
clared in this scope
return-s <<"F";
19
} else if (cScore >= 70) {
The function printGrade has been
20
return-s <« "c";
21
} else if (cScore >= 60) {
posted below for your convenience.
main.cpp:24:16: error: return-stateme
nt with a value, in function returnin
g 'void' [-fpermissive]
return-s <«"F";
22
return-s < "D";
23
} else {
24
return-s <<"F";
void printGrade(int cScore)
/bin/bash: line 4: ./a.out: No such f
ile or directory
25
}
{
26
}
cout <« "The course grade is: ";
6:42 PM
P Type here to search
I'm desperately in n.
MindTap - Cengag..
ProgramminExercis.
4/13/2020
Transcribed Image Text:MindTap - Cengage Learning - Microsoft Edge A https://ng.cengage.com/static/nb/ui/evo/index.html?deploymentld=57811235846758605217306036&elSBN=9781337274715&id=7109378718&snapshotld=1589550& >> CENGAGE MINDTAP Q Search this course Programming Exercise 6-19 Introduction main.cpp >- Terminal 1 //Define include-header files main.cpp:18:17: error: return-stateme nt with a value, in function returnin g 'void' [-fpermissive] return-s << "B"; 2 #include <iostream> Instructions #include <string.h> A-Z The function printGrade in Example main.cpp:20:12: error: “s' was not de clared in this scope return-s << "C"; </> 6-13 is written as a void function to 6 //Define namespace statements compute and output the course 7 using namespace std; main.cpp:20:17: error: return-stateme nt with a value, in function returnin g 'void' [-fpermissive] return-s << "c"; grade. The course score is passed as a 9 void calculateGrade(int cScore) parameter to the function 10 printGrade. Rewrite the function 11 //Define the void calculateGrade user-defined, value-returing function. printGrade as a value-returning function so that it computes and main.cpp:22:12: error: 's' was not de clared in this scope return-s << "D"; 12 { 13 cout <«"Your grade for the course is: "; 14 { returns the course grade. (The course main.cpp:22:17: еггог: геturn-stateme nt with a value, in function returnin g 'void' [-fpermissive] return-s << "D"; 15 if (cScore >= 90) { bango grade must be output in the function 16 return-s <« "A"; main .) Also, change the name of the } else if (cScore >= 80) { 17 function to calculateGrade . return-s << "B"; 18 main.cpp:24:12: error: s' was not de clared in this scope return-s <<"F"; 19 } else if (cScore >= 70) { The function printGrade has been 20 return-s <« "c"; 21 } else if (cScore >= 60) { posted below for your convenience. main.cpp:24:16: error: return-stateme nt with a value, in function returnin g 'void' [-fpermissive] return-s <«"F"; 22 return-s < "D"; 23 } else { 24 return-s <<"F"; void printGrade(int cScore) /bin/bash: line 4: ./a.out: No such f ile or directory 25 } { 26 } cout <« "The course grade is: "; 6:42 PM P Type here to search I'm desperately in n. MindTap - Cengag.. ProgramminExercis. 4/13/2020
MindTap - Cengage Learning - Microsoft Edge
A https://ng.cengage.com/static/nb/ui/evo/index.html?deploymentld=57811235846758605217306036&elSBN=9781337274715&id=7109378718&snapshotld=1589550&
>>
CENGAGE MINDTAP
Q Search this course
Programming Exercise 6-19
Introduction
main.cpp
>- Terminal
17
} else if (CScore >= 80) {
main.cpp:18:17: error: return-stateme
nt with a value, in function returnin
g 'void' [-fpermissive]
return-s << "B";
18
return-s <« "B";
Instructions
} else if (cScore >= 70) {
19
A-Z
20
return-s << "c";
The function printGrade in Example
} else if (cScore >= 60) {
main.cpp:20:12: error: “s' was not de
clared in this scope
return-s << "C";
22
return-s << "D";
</>
6-13 is written as a void function to
23
} else {
compute and output the course
24
return-s <<"F";
main.cpp:20:17: error: return-stateme
nt with a value, in function returnin
g 'void' [-fpermissive]
return-s << "C";
grade. The course score is passed as a
}
25
parameter to the function
26
printGrade . Rewrite the function
27
}
28 int main()
printGrade as a value-returning
function so that it computes and
main.cpp:22:12: error: 's' was not de
clared in this scope
return-s << "D";
29 {
30
//Define the variables
returns the course grade. (The course
int cScore;
main.cpp:22:17: еггог: геturn-stateme
nt with a value, in function returnin
g 'void' [-fpermissive]
return-s << "D";
31
bango
grade must be output in the function
32
main .) Also, change the name of the
33
//Prompt the user to input their course score to calculate their grade.
function to calculateGrade .
34
cout <<"what is is your final course score? :" << endl;
main.cpp:24:12: error: s' was not de
clared in this scope
return-s <<"F";
35
//Read the inputted score
36
cin >> cScore;
The function printGrade has been
37
posted below for your convenience.
main.cpp:24:16: error: return-stateme
nt with a value, in function returnin
g 'void' [-fpermissive]
return-s <«"F";
38
//Test the calculateGrade(cScore) function
39
cout <«"The grade is: "
<« cscore << endl;
40
void printGrade(int cScore)
return 0;
41
/bin/bash: line 4: ./a.out: No such f
ile or directory
{
42 }
43
cout <« "The course grade is: ";
7:01 PM
P Type here to search
I'm desperately in n.
MindTap - Cengag.-
ProgramminExercis.
14
4/13/2020
Transcribed Image Text:MindTap - Cengage Learning - Microsoft Edge A https://ng.cengage.com/static/nb/ui/evo/index.html?deploymentld=57811235846758605217306036&elSBN=9781337274715&id=7109378718&snapshotld=1589550& >> CENGAGE MINDTAP Q Search this course Programming Exercise 6-19 Introduction main.cpp >- Terminal 17 } else if (CScore >= 80) { main.cpp:18:17: error: return-stateme nt with a value, in function returnin g 'void' [-fpermissive] return-s << "B"; 18 return-s <« "B"; Instructions } else if (cScore >= 70) { 19 A-Z 20 return-s << "c"; The function printGrade in Example } else if (cScore >= 60) { main.cpp:20:12: error: “s' was not de clared in this scope return-s << "C"; 22 return-s << "D"; </> 6-13 is written as a void function to 23 } else { compute and output the course 24 return-s <<"F"; main.cpp:20:17: error: return-stateme nt with a value, in function returnin g 'void' [-fpermissive] return-s << "C"; grade. The course score is passed as a } 25 parameter to the function 26 printGrade . Rewrite the function 27 } 28 int main() printGrade as a value-returning function so that it computes and main.cpp:22:12: error: 's' was not de clared in this scope return-s << "D"; 29 { 30 //Define the variables returns the course grade. (The course int cScore; main.cpp:22:17: еггог: геturn-stateme nt with a value, in function returnin g 'void' [-fpermissive] return-s << "D"; 31 bango grade must be output in the function 32 main .) Also, change the name of the 33 //Prompt the user to input their course score to calculate their grade. function to calculateGrade . 34 cout <<"what is is your final course score? :" << endl; main.cpp:24:12: error: s' was not de clared in this scope return-s <<"F"; 35 //Read the inputted score 36 cin >> cScore; The function printGrade has been 37 posted below for your convenience. main.cpp:24:16: error: return-stateme nt with a value, in function returnin g 'void' [-fpermissive] return-s <«"F"; 38 //Test the calculateGrade(cScore) function 39 cout <«"The grade is: " <« cscore << endl; 40 void printGrade(int cScore) return 0; 41 /bin/bash: line 4: ./a.out: No such f ile or directory { 42 } 43 cout <« "The course grade is: "; 7:01 PM P Type here to search I'm desperately in n. MindTap - Cengag.- ProgramminExercis. 14 4/13/2020
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
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education