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

Input 1.) You ask the user to enter the exact number of students (n), and you ne

ID: 3625357 • Letter: I

Question

Input
1.) You ask the user to enter the exact number of students (n), and you need to check if the input is between 1 and 40 students. If not, error message and ask the user to enter the data again.
2.) You ask the user to enter the grades for student i, where (1<=i<=n)

Output
1.) The program prints the student number (index) who got 100 in the Math class.
2.) The program prints the student (index) who got less than 50 in the Biology class.
3.) The program prints the student number (i) who got 100 in Math and 90 in Physics.
4.)The program prints the number of students who got more than 90 in the four subjects.
5.) The program prints the number of students who got less than 50 in any of the four subjects.
6.) The program prints the maximum grade in Chemistry.
7.) The program prints the minimum grade in Math.
Here is what I have:
I need to figure out how to add steps 4-7. Please help!! Will Rate!!
#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
int n=0,flag=0;
double A[100],B[100],C[100],D[100];
cout<<"Please enter the number of students in your class?";
cin>>n;

for (int i=0;i<n;i++)
{
cout<<"Please enter the Math grade";
cin>>A[i];
cout<<"Please enter the Biology grade";
cin>>B[i];
cout<<"Please enter the Chemistry grade";
cin>>C[i];


}

for (int i=0;i<n;i++)
{
if (A[i]==100)
{
cout<<"Student "<<i+1<<" received a 100 in Math";
}
}

for (int k=0;k<n;k++)
{

if (A[k]<50)
{
cout<<"Student "<<k<<" received less than 50 in Biology";
}
}

for (int c=1;c<=n;c++)
{
cout<<"Please enter the Physics grade";
cin>>A[c];
}
for (int y=0;y<n;y++)
{
if (A[y]=100 && C[y]==90)
{
flag=1;
cout<<"Student "<<y<<" got a 100 in math and 90 in physics";
}
}

Explanation / Answer

please rate - thanks

I cleaned up some of what you did, including changing math from array A to array M - makes more sense

#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
int n=0,flag=0,max=0,min=0,count;
double M[40],B[40],C[40],D[40],P[40];
cout<<"Please enter the number of students in your class? ";
cin>>n;
while(n<1&&n>40)
    {cout<<"Must be between 1 and 40 ";
     cout<<"Please enter the number of students in your class? ";
     cin>>n;
     }
for (int i=0;i<n;i++)
{cout<<"For student "<<i+1<<endl;
cout<<"Please enter the Math grade ";
cin>>M[i];
cout<<"Please enter the Biology grade ";
cin>>B[i];
cout<<"Please enter the Chemistry grade ";
cin>>C[i];
cout<<"Please enter the Physics grade ";
cin>>P[i];
}
cout<<endl;
for (int i=0;i<n;i++)
   {
    if (M[i]==100)
       {
        cout<<"Student "<<i+1<<" received a 100 in Math ";
       }
    }
for (int k=0;k<n;k++)
   {if (B[k]<50)
      {
       cout<<"Student "<<k<<" received less than 50 in Biology ";
      }
    }
for (int y=0;y<n;y++)
   {if (M[y]==100 && P[y]==90)
        cout<<"Student "<<y<<" got a 100 in math and 90 in physics ";
   }
count=0;
for(int i=0;i<n;i++)
      if(M[i]>90&&B[i]>90&&C[i]>90&&P[i]>90)
            count++;
cout<<count<<" students got greater than 90 in the 4 subjects ";           
count=0;

for(int i=0;i<n;i++)
      if(M[i]<50||B[i]<50||C[i]<50||P[i]<50)
            count++;
cout<<count<<" students who got less than 50 in any of the 4 subjects ";
for(int i=1;i<n;i++)
   {if(C[i]>C[max])
        max=i;
    if(M[i]<M[min])
        min=i;
        }
cout<<"The student with the highest chemistry grade is student "<<max+1<<endl;
cout<<"The student with the lowest math grade is student "<<min+1<<endl;
system("pause");
return 0;
}