I need help. It\'s in C++. Your job is to create a program that takes, from keyb
ID: 3886984 • Letter: I
Question
I need help. It's in C++.
Explanation / Answer
#include<iostream>
using namespace std;
int main()
{
int n;//variable to store number of students
int p;//variable to store number of points for assignment
int g[n];////variable to store grades..
int sum=0,rsum=0;//for calculating sum
//taking input..
int i=0;
cout<<"Enter number of students :";
cin>>n;
cout<<"Enter number of points for assignment :";
cin>>p;
cout<<"Enter "<<n<<" grades (0 to "<<p<<" ): " ;
while(i<n)
{
cin>>g[i];
sum = sum+g[i];
rsum =rsum+p;
i++;
}
float average =sum/n;//finding average///
float curvevalue = 0.7*rsum;//curve at 70% to find curve
//if condition.. to find curve value..
if(average>=curvevalue)//means curve is zero..no curve..
{
cout<<"Curve is zero ";
}
else
{
cout<<"average shoulde be increased by "<<curvevalue-average<<" to reach 70% ";
}
return 0;
}
output:-
Enter number of students :6
Enter number of points for assignment :10
Enter 6 grades (0 to 10 ):
9
3
2
4
8
6
average shoulde be increased by 37 to reach 70%
Process exited normally.
Press any key to continue . . .