I am working on this program. The array has 10 scores. (there is more to this program.) Does the last "for" section make sense?
/*Defines a global constant called N throughout the file.
Note that N = 10.
*/
#define N 10
#include <iostream>
using namespace std;
/*Define a StudentScores class with methods called
(1) getHighestScore – find the highest score in the array
(2) getLowestScore – find the lowest score in the array
(3) getAverageScore – compute the average score
*/
class StudentScores
{
private:
int _scores[N];
public:
StudentScores(i nt scores[])
{
for(int i = 0; i < N; i = i + 1)
_scores[i] = scores[i];
}
int getHighestScore ()
{
int highest;
highest = _scores[0];
for (int i = 0; i < N; i++)
if (a [i]> scores [0]
highest = a [i]
return highest;
/*Defines a global constant called N throughout the file.
Note that N = 10.
*/
#define N 10
#include <iostream>
using namespace std;
/*Define a StudentScores class with methods called
(1) getHighestScore – find the highest score in the array
(2) getLowestScore – find the lowest score in the array
(3) getAverageScore – compute the average score
*/
class StudentScores
{
private:
int _scores[N];
public:
StudentScores(i nt scores[])
{
for(int i = 0; i < N; i = i + 1)
_scores[i] = scores[i];
}
int getHighestScore ()
{
int highest;
highest = _scores[0];
for (int i = 0; i < N; i++)
if (a [i]> scores [0]
highest = a [i]
return highest;
Comment