
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 }
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.