i need help in adding the c++ code for the average mark, highest mark, lowest mark, number of students passing, using array

01  #include<iostream>
02  using namespace std;
03  int main()
04  {
05      int gradeRange [4]= {0,0,0,0};
06      int mark = 0;
07      int counter = 0;
08   
09      while (mark < 101)
10      {
11       
12         cin >> mark;
13         if (mark > 100)
14  break;
15  if (mark >= 70)
16  gradeRange [3] ++;
17  else if (mark >= 40)
18  gradeRange [2] ++;
19  else if (mark >= 30)
20  gradeRange [1] ++;
21  else
22  gradeRange [0] ++;
23   
24  }
25  while (counter < 4)
26   
27  {
28  if (counter == 0)
29  cout << "0 - 29 ";
30  else if (counter == 1)
31  cout << "30 - 39 ";
32  else if (counter == 2)
33  cout << "40 - 69 ";
34  else
35  cout << "70 - 100 ";
36  for ( int i = 1; i <= gradeRange [counter] ; i ++)
37  {
38  cout << "*";
39  }
40  counter ++;
41  cout << endl;
42  }
43   
44  system("PAUSE");
45  }

Create a container (probably a large array, to hold the largest number of marks that you could reasonably expect to read in) to hold all the marks as they are read in so you can search the data as desired, or create variables to hold each of the desired and update each variable as they are read in.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.