Bubble sorting an array, calculating medians, and outputting the array.

I'm quite new here and having a hard time wrapping my head around the subject. Basically, I need to take input from a data file, bubble sort it into an array in ascending order and calculate a few median values, (p50 = median(x, n); p25 = median(x, n/2); p75 = median(x + n/2 + 1, n/2)). I have the median part of the function but I guess I am just stumped on the bubble sorting in ascending order from a file. My guess is that this has to be three functions, one to bubble sort, one to calculate a median, and one to output the array. Any pointers or help would be greatly appreciated.
Okay I figured some stuff out, I just don't know how to turn the normal cin and cout (like telling the user to insert their own numbers) to reading the data from a file. Thanks in advance guys.
you can try use the file operations functions in fstream module,

http://www.cplusplus.com/reference/fstream/fstream/
Topic archived. No new replies allowed.