C++ array find the average mark, highest mark, lowest mark, number of students passing,?
i need help in adding the c++ code for the average mark, highest mark, lowest mark, number of students passing, using array for this code.
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
|
#include<iostream>
using namespace std;
int main()
{
int range [4]= {0,0,0,0};
int marks = 0;
int counter = 0;
cout << " Enter All The Marks" << endl;
while (marks < 101)
{
cin >> marks;
if (marks > 100)
break;
if (marks >= 70)
range [3] ++;
else if (marks >= 40)
range [2] ++;
else if (marks >= 30)
range [1] ++;
else
range [0] ++;
}
while (counter < 4)
{
if (counter == 0)
cout << "0 - 29 ";
else if (counter == 1)
cout << "30 - 39 ";
else if (counter == 2)
cout << "40 - 69 ";
else
cout << "70 - 100 ";
for ( int i = 1; i <= range [counter] ; i ++)
{
cout << "*";
}
counter ++;
cout << endl;
}
system("PAUSE");
}
|
Topic archived. No new replies allowed.