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

Write a c++ program that calculates the total for P classroom exercises as a per

ID: 3628626 • Letter: W

Question

Write a c++ program that calculates the total for P classroom exercises as a percentage.The user should input the value for N followed by each of the P scores and totals.Calculate the overall percentage (sum of the total points earned divided by the total points possible) and output it as a percentage.SAMPLE INPUT AND OUTPUT SHOWN BELOW.

How many exercises to input? 3

Score received for exercise 1:10
Total points possible for exercise1:10

Score received for exercise 2: 7
Total points possible for exercise 2: 12

Score received for exercise 3: 5
Total points possible for exercise 3:8

Your total score is 22 out of 30 ,or 73.33%

Explanation / Answer

please rate - thanks

#include <iostream>
#include <iomanip>
using namespace std;
int main()
{int i,n,points=0,possible=0,totpoints=0,totpossible=0;
double average;
cout<<"How many exercises to input? ";
cin>>n;
i=1;
for(i=1;i<=n;i++)
   {cout<<" Score received for exercise "<<i<<": ";
   cin>>points;
   totpoints+=points;
   cout<<"Total points possible for exercise "<<i<<": ";
   cin>>possible;
   totpossible+=possible;
   }
average=(double)totpoints/totpossible*100.;
cout<<" Your total score is "<<totpoints<<" out of "
      <<totpossible<<", or "<<setprecision(2)<<fixed<<average<<"% ";
system("pause");
return 0;
}

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