using MathCad 3 Write the grades as a column vector a Use s


using MathCad

# 3. Write the grades as a column vector. (a) Use sort( ) function to sort the 15 scores (elements 0 to 14) listed below, (b) then display the value of 7th element in the sorted array. 7th element = median (c) Check your result from part (b) by using Mathcad’s median( ) function on the original vector of grades.

Grades = [ 78   85   43   67   65   98   56   87    90   86   65   79   80   69   71 ]

Solution

#include <iostream>
#include <stdlib.h>
#include <time.h>
using namespace std;
int main ()
{
int vector[5],temp;
for(int i=0;i<5;i++){
cin>>vector[i];

}

for(int p=0 ; p<5;p++){

for(int q=p ; q<5 ; q++){

if(vector[p] > vector[q]){
temp=vector[q];
vector[q]=vector[p];
vector[p]=temp;


}

}
}

for(int i=0;i<5;i++){
cout<<vector[i];
}
return 0;
}

 using MathCad # 3. Write the grades as a column vector. (a) Use sort( ) function to sort the 15 scores (elements 0 to 14) listed below, (b) then display the va

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site