int main()
{
const int N = 8;
string names[] = {"Jack","John","Mary","Mike","Helen","Phill","Sew","Elis"};
char grades[] = {'B','E','A','D','C','F','E','B'};
cout << "Table with grades of students:\n";
for (int i = 0; i < N; i++)
{
cout << names[i] << "\t" << grades[i] << endl;
}
char maxgrade = grades[0];
int n=0;
for (int i = 0; i < N; i++)
{
if(grades[i]<maxgrade)
{
maxgrade = grades[i];
n=i;
}
}
cout << "The best grade is " << grades[n]
<< "\nIt has " << names[n];
}
please understand the code me by comments so please do it.
Comments
Leave a comment