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

Please write your own source code and make sure that the code compiles. C++ Prog

ID: 3838356 • Letter: P

Question

Please write your own source code and make sure that the code compiles. C++ Programming

Grade Calculator: GradeCalculator.cpp
Write a program that reads student scores, gets the best score (BestScore), and then assigns letter grades based on the following scheme:
A: [BestScore, BestScore – 10] B: (BestScore – 10, BestScore – 20] C: (BestScore – 20, BestScore – 30] D: (BestScore – 30, BestScore – 40] F: Lower than BestScore – 40.
The program should prompt the user to enter the total number of students, then prompt the user to enter all of the scores, and conclude by displaying the letter grades. Here is a sample run:

Enter the number of students: 4

Enter 4 scores: 40 55 70 58

Student 0 – Score: 40, Letter: C

Student 1 – Score: 55, Letter: B

Student 2 – Score: 70, Letter: A

Student 3 – Score: 58, Letter: B

Explanation / Answer

#include<bits/stdc++.h>
using namespace std;

int main() {
   int students;
   cout<<"Enter the number of students:"<<endl;
   cin>>students;
   int marks[students];
   int bestScore = 0;
   for(int i =0;i<students;i++)
   {
       cin>>marks[i];
       if(marks[i]> bestScore)
       {
           bestScore = marks[i];
       }
   }
   //cout<<bestScore<<endl;
   for(int i =0;i<students;i++)
   {
       //cout<<marks[i]<<endl;
       if(bestScore >= marks[i] && marks[i] >=(bestScore-10))
       {
           cout<<"Student"<<i<<"– Score :" <<marks[i]<< ",Letter: A"<<endl;
       }
       if((bestScore-10) > marks[i] && marks[i]>= (bestScore-20))
       {
           cout<<"Student"<<i<<"– Score :" <<marks[i]<< ",Letter: B"<<endl;
       }
       if((bestScore-20)> marks[i] && marks[i] >= (bestScore-30))
       {
           cout<<"Student"<<i<<"– Score :" <<marks[i]<< ",Letter: C"<<endl;
       }
       if((bestScore-30) > marks[i] && marks[i]>= (bestScore-40))
       {
           cout<<"Student"<<i<<"– Score :" <<marks[i]<< ",Letter: D"<<endl;
       }
       if((bestScore-40) > marks[i])
       {
           cout<<"Student"<<i<<"– Score :" <<marks[i]<< ",Letter: F"<<endl;
       }
   }
   return 0;
}