Should be easy fix but cant figure it out?

so i have to fix my histogram function to return 1 if there are no numbers in the parameter array and fix return for if the number of scores is greater than zero please help!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
int histogram(int,const int[],int[]);
int main()
{
  int grade[5] = {0}; //={} is for newer compilers only
	histogram(nScores, score, grade);
	  cout << "As: " << grade[0] << endl;
	  cout << "Bs: " << grade[1] << endl;
	  cout << "Cs: " << grade[2] << endl;
	  cout << "Ds: " << grade[3] << endl;
	  cout << "Fs: " << grade[4] << endl;
  }
  else
	cout << "no data" << endl;
}

int histogram(int nScores, const int accepted[], int letterGrade[])
{
  if(accepted[0] < 0)
  {
    return 1;
  }
  if(nScores == 0)
  {
    return 0;
  }
  
  for(int i = 0; i < nScores; i++)
  {
    if(accepted[i] >= 90)
    {
	  letterGrade[0]++;
    }
    else if(accepted[i] >= 80 && accepted[i] <= 89)
    {
	  letterGrade[1]++;
    }
    else if(accepted[i] >= 70 && accepted[i] <= 79)
    {
	  letterGrade[2]++;
    }
    else if(accepted[i] >= 60 && accepted[i] <= 69)
    { 
	  letterGrade[3]++;
    }
    else if(accepted[i] < 50)
    {
	  letterGrade[4]++;
    }
  }
}
Topic archived. No new replies allowed.