Write a program that determines a student’s grade. The program will read three types of scores (quiz, mid-term, and final scores) and determine the grade based on the following rules:if the average score =90% =>grade=A…………………..-if the average score >= 70% and <90% => grade=B……………………-if the average score>=50% and <70% =>grade=C……………………..-if the average score<50% =>grade=F.

Explanation:

  1. Pass-by-Value (determineGradeByValue):
    • Function Definition: char determineGradeByValue(double quiz, double midTerm, double finalExam)
    • This function takes three scores as input parameters by value (i.e., copies of the original values).
    • It calculates the average score.
    • Based on the average, it determines the grade:
      • >= 90% results in grade A
      • >= 70% and < 90% results in grade B
      • >= 50% and < 70% results in grade C
      • < 50% results in grade F
    • The function returns the determined grade.
  2. Pass-by-Reference (determineGradeByReference):
    • Function Definition: void determineGradeByReference(double quiz, double midTerm, double finalExam, char &grade)
    • This function also receives three scores but takes a reference to the grade variable to store the result.
    • It calculates the average score similarly.
    • It assigns the appropriate grade directly to the grade reference variable.
  3. Main Function (main):
    • The program prompts the user to input the quiz, mid-term, and final exam scores.
    • It calculates the grade using both methods and prints the results.

Example Outputs:

Example 1:

Input:

  • Quiz Score: 85
  • Mid-Term Score: 90
  • Final Exam Score: 88

Output:

Example 2:

Input:

  • Quiz Score: 45
  • Mid-Term Score: 60
  • Final Exam Score: 55

Output:

Example 3:

Input:

  • Quiz Score: 92
  • Mid-Term Score: 94
  • Final Exam Score: 96

Output:

 

All Copyrights Reserved 2025 Reserved by T4Tutorials