How to call a function

Oct 22, 2014 at 1:27am
How do i call this function? It doesnt show up or i get errors

1
2
3
4
5
6
7
8
9
10
  void med(int howmany, int grades[])
{
	if (howmany % 2 != 0){
		int temp = ((howmany + 1) / 2) - 1;
		cout << "The median is " << grades[temp] << endl;
	}
	else{
		cout << "The median is " << grades[(howmany / 2) - 1] << " and " << grades[howmany / 2];
	}
}
Oct 22, 2014 at 1:30am
Thank you for adding the tags, but you could have just edited your original post.

In any case, as I asked in your other thread, could you show us how you are calling the function so we can see what you are doing incorrectly?
Oct 22, 2014 at 1:34am
Protoype is

void med(int, int);

I do not currently have a call for it because i can not get it to work. What do i put in my main function to make this function run?
Oct 22, 2014 at 1:36am
That prototype doesn't match the definition. Are you sure that's the protoype?

What is the function supposed to do? What is the meaning of the howmany and grades parameters?
Oct 22, 2014 at 2:31am
Topic archived. No new replies allowed.