0

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

  #include<iostream>
  using namespace std;
  int main()
  {
      int gradeRange [4]= {0,0,0,0};
      int mark = 0;
      int counter = 0;

      while (mark < 101)
      {

         cin >> mark;
         if (mark > 100)
  break;
  if (mark >= 70)
  gradeRange [3] ++;
  else if (mark >= 40)
  gradeRange [2] ++;
  else if (mark >= 30)
  gradeRange [1] ++;
  else
  gradeRange [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 <= gradeRange [counter] ; i ++)
  {
  cout << "*";
  }
  counter ++;
  cout << endl;
  }

  system("PAUSE");
  }
2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by m4ster_r0shi
0

You really should google more before posting. Look, I found a thread with a guy having the exact same code and a very similar problem to the one you're having. Considering the degree of similarity, I believe the replies he got should also be applicable to your case.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.