Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a function that has two parameters: - an integer that is a test score - an

ID: 3684679 • Letter: W

Question

Write a function that has two parameters: - an integer that is a test score - and a second parameter that is the letter grade. The function will place a value in the second parameter Use the standard grading scale for A, B, C, D, F. If the score is above 100 or below 0, a grade will not be assigned and a return value of false will be returned. If the score is within range, a return value of true will be returned and the letter grade will be placed in the second parameter. The prototype for the function is: bool figureGrade(int, char &); Write a main function to test the function you have written.

Explanation / Answer

Grade.cpp

#include<iostream>
using namespace std;
bool grade(int,char&);
int main()
{
char gra=0;
bool res=grade(80,gra);
   if(res)
   {
   cout<<" Grade for the Score is "<<gra;
   }else
   {
   cout<<" Grade for the Score is "<<res<<gra;
   }
   return 0;
}

bool grade(int score,char& grade)
{
   if(score>100 || score<0)
   {
       return false;
   }else
   {
   if(score>=90&&score<=100)
   {
       grade='A';
       return true;
   }else if(score>=80&&score<90)
   {
       grade='B';
       return true;
   }else if(score>=70&&score<80)
   {
       grade='C';
       return true;
   }else if(score>=60&&score<70)
   {
       grade='D';
       return true;
   }else
   {
       grade='F';
       return true;
   }
}

}

OutPut:

Grade for the Score is B

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote