77 895
Assignments Done
Successfully Done
In August 2019

Answer to Question #4219 in C++ for Mz Jackee

Question #4219
Determine the median selling price of all homes in a subdivision named Botany Bay sold during one year. Allow the user to enter the number of houses sold and store their selling prices in an array. The median of a list of N numbers is as follows:

a. The middle number of the sorted list, if N is off
b. The average of the two middle numbers in the sorted list, if N is even

(Hint: after inputting the prices into an array, sort that array.)
Expert's answer
#include <iostream>
using namespace std;

int main() {
int num;
cout<<"enter number"<<endl;
int arr[num];
cout<<"enter prices"<<endl;
for (int i = 0; i<num; i++)
for (int i = 0; i<num; i++)
for (int j = 0; j<num-1; j++)
if (arr[i]<arr[j]) {
int buf = arr[i];
arr[i] = arr[j];
arr[j] = buf;
if ((num % 2) == 0)
cout<<(arr[num/2] + (float)arr[(num/2)-1])/2<<endl;
return 0;

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions