I'm pretty new at C++ and I have a problem with a program that opens a file with a list of numbers and finds the median. My problem is, no matter what numbers are in the file, it always says the median is 1. I've been able to tell it what position the median is in, but I can't get it to return the number that's in that position. How can I get it to reopen the file, find the median number, and spit it back to me?
Attached is what I've done so far.
Here is what the data file is uses looks like:
file2.dat
1
2
3
4
5
6
7
8
I know the simplicity of it is laughable, but bear with me. I'm a newbie.