Getting Median From Array

I am trying to get a median from an array of which i do now know how many items are in it. I know I have to sort it, but I do not how to do this to get the median. Here is what I have so far. How do i go about finding the median?
1
2
3
4
5
6
7
8
9
10
11
12
13
  int howmany;
	int sum = 0;
	int grades[100];

	cout << "How many grades do you have for Exam 2?"; cout << endl;
	cin >> howmany;
	cout << "Please enter the grades for Exam 2"; cout << endl;

	for (int i = 0; i < howmany; ++i){
		cout << "Enter Grade " << i + 1 << ": ";
		cin >> grades[i];
		sum += grades[i];
	}   // End For 
closed account (48T7M4Gy)
http://www.cplusplus.com/articles/NhA0RXSz/

Warning: requires C++11 compiler
closed account (48T7M4Gy)
Is this related to this:

Will be, after the array is sorted it shows where the median value is ( more or less ).
Topic archived. No new replies allowed.