Hey Andrew first please use code tags when posting code in the forums (Hint: the <> off to the right when replying lol I actually got a macro for posting this now) it helps people read your code since it will be formated properly.
Now for the problems that I seen. I just did a quick scan so I probably missed a couple.
1) Your putting your functions inside your
int main()
. The functions should be outside of it. If they are in the same .cpp file as your
int main()
put the definitions below main and have the declarations above main. Here is a example
1 2 3 4 5 6 7 8 9 10 11
|
double median(int*, int); // Declaration
int main ()
{
// Your main code here
}
double median(int *movies, int size); // Definition
{
// Your function code here
}
|
Thats the main thing that I saw, and a lot of other things that were off but I don't have time to comment on each one so I will just give you a overview.
You need help on how functions work. Check out this link www.cplusplus.com/doc/tutorial/functions/
You need help on how for loops work, you forgot to declare a type in
for (y = x + 1; y < size; y++)
and the other ones. Check out this link www.cplusplus.com/doc/tutorial/control/
And your missing a ) in this line
return ((double) ((*(movies + (size / 2) - 1)) + (*(movies + (size / 2))) / 2.0));
.
Now that should fix all the error but I'm not sure if it will run as promised since I didn't have time to look to in detail at it. Once I get off work I can help more if you need it just send a PM or post here.