The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 398 Weeks Ago, 1 Day Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
Write a well structured C++ program that will use BubbleSort to sort an array of integers into ascending order. However, there is more to the assignment than just sorting. Write at least 3 functions in this program, one for doing the bubble sort, one for calculating a median, and one for outputting the array.
The median of a sorted array of numbers is defined as the middle element, or the average of the middle two items if the number of items is even. Write a function, called median, which returns a double which is the median of a sorted array of integers.
percent < scores.dat
That causes your program to take its cin type input from the file scores.dat instead of the keyboard.
Now after reading the array of scores from scores.dat and counting how many items it contains, do the following:
sort the array using your bubble sort.
p50 = median(x, n);
p25 = median(x, n/2);
p75 = median(x + n/2 + 1, n/2);
and print these out.
What "these" are, are percentile values. p50 is the 50th percentile, the score that half the class scored better than and half did worse. p25 is the 25th percentile while p75 is the 75th percentile.
So, overall you will
read the array values from "the keyboard"
sort the array
calculate the percentile values p25, p50, and p75
print the sorted array (print 10 values per line)
print (with labels so we know what they are) the percentile values
BE CERTAIN TO HAVE AT LEAST 3 SEPARATE FUNCTIONS --
one for bubble sort
one for calculating a median
one for printing an int array, say
  void print(int x[], int n, int num_across)
with num_across being how many values to print per line
(should be 10 for this program).
Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------acq-----------uis-----------iti-----------on -----------of -----------my -----------pos-----------ted----------- so-----------lut-----------ion-----------.Pl-----------eas-----------e p-----------ing----------- me----------- on-----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be-----------