Need help here

#include<iostream> // required for cin , cout
#include<cmath> // required for sqrt()

using namespace std;

int main()
{
const int size=56;

double R[size]={45.3, 67.8, 34.3, 51.2, 48.5, 61.3, 59.3, 65.1,
49.3, 42.4, 63.5, 69.8, 71.2, 39.8, 55.5, 53.2,
56.7, 48.8, 61.5, 51.2, 58.9, 63.1, 67.5, 62.4,
52.4, 50.2, 49.8, 56.8, 59.7, 60.4, 45.8, 43.8,
51.3, 54.8, 55.1, 52.3, 56.2, 59.7, 63.0, 46.7,
63.1, 58.2, 41.9, 59.2, 57.2, 67.3, 68.2, 38.9,
51.3, 63.8, 53.4, 58.9, 56.3, 58.9, 53.2, 56.8};

double sum=0, sum1=0, mean, temp, max, min, range, std, variance;

// find the mean
for (int count=0; count<=(size-1); count++)
{

sum=sum+R[count];// add up all numbers in the array
}

mean= ;

// Sort the data

for( int i=0; i<=size-2; i++)
{
for( int j=i+1; j<=size-1; j++)
{

if (R[j]>R[i])
// swap R[i] and R[j]
{
temp=R[i];
R[i]=R[j];
R[j]=temp;

}

}
}


for( int k=0; k<=size-1; k++)
{
sum1=sum1+(R[k]-mean)*(R[k]-mean);// add up (xi-mean)^2
cout<<R[k]<<endl;// print the sorted array
}

max= ;

min ;

range= ;

variance=sum1/ ;

std=sqrt(variance);

cout<<"The mean is "<<mean<<endl;
cout<<"The maximum is "<<max<<endl;
cout<<"The minimum is "<<min<<endl;
cout<<"The range is "<<range<<endl;
cout<<"The Variance
cout<<"The standard deviation is

/*double x=3, y=5, sum=0, sub, mul, div;

cout<<"Welcome to EGR120! Today is April 7"<<endl<<endl;
cout<<"Please enter two integers, x and y. The value of y can not be zero."<<endl;
cin>>x>>y;


sum=x+y;
sub=x-y;
mul=x*y;
div=x/y;

cout<<x<<" + "<<y<<" = "<<sum<<endl;
cout<<x<<" - "<<y<<" = "<<sub<<endl;
cout<<x<<" * "<<y<<" = "<<mul<<endl;
cout<<x<<" / "<<y<<" = "<<div<<endl; */

system("pause");

}
use code blocks and explain what the problem you are trying to solve is...

max= ;

min ;

range= ;

variance=sum1/ ;

at first glance
Yes

max= ;

min ;

range= ;

variance=sum1/ ;

also

The standard deviation


Can help me please i am having difficulty
i'm having difficulty understanding the problem.. you have incomplete code...

you offered no project or explanation of what you are trying to achieve..

This is the questions that have difficulty

The number lists shows the resistances, in ohms, measured for each resistor in the batch. Write a computer program to determine the following:

(a) Maximum
(b) Minimum
(c) Range
(d) Mean
(e ) Standard deviation
(f) Variance
(g) Median
http://cplusplus.com/forum/general/68437/

Please do not double post.

You understand [b]bold[/b] tags, now please put your code in [code]//code [/code] tags.

You also fail to provide an actual question or problem. Please clearly outline what you are trying to do and what you are having problems with.
Thank YOU VERY MUCH.

I will post it as soon as possible
I am done with Range, Mean, Variance, Now I want to locate the median.
Can you help with please.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include<iomanip>
using namespace std;
int main()
{

          const int size=56;    

    double sum=0, mean, max=0, min=100, range, variance;
    double R[size]={45.3, 67.8, 34.3, 51.2, 48.5, 61.3, 59.3, 65.1,
                           49.3, 42.4, 63.5, 69.8, 71.2, 39.8, 55.5, 53.2,
                           56.7, 48.8, 61.5, 51.2, 58.9, 63.1, 67.5, 62.4,
                           52.4, 50.2, 49.8, 56.8, 59.7, 60.4, 45.8, 43.8,
                           51.3, 54.8, 55.1, 52.3, 56.2, 59.7, 63.0, 46.7,
                           63.1, 58.2, 41.9, 59.2, 57.2, 67.3, 68.2, 38.9,
                           51.3, 63.8, 53.4, 58.9, 56.3, 58.9, 53.2, 56.8};
  
    for(int i=0;i<size-1;i++)
       sum+=sum+R[i];
//Find mean
    mean=sum/size;
  
    max=R[0];
   
//Find Maximum
      for(int i=1;i<size-1;i++)
    {
       if(R[i]>max)
           max=R[i];
    }
  
//Find Minimum
    min=R[0];
   
//Find Maximum
    for(int i=1;i<size-1;i++)
    {
       if(R[i]<min)
           min=R[i];
    }
  
//Find Range
    range=max-min;
// Find the variance and standard deviation
    double v Sum=0;

    for(int i=0;i<size-1;i++)
    {
       vSum+=pow(R[i]-mean,2);
    }

//finding variance
    variance=vSum/size;

    cout<<"Maximum of R\t :"<<max<<endl;
    cout<<"Minimum of R \t:"<<min<<endl;   
    cout<<"Mean \t"<<mean<<endl;
    cout<<"Range of R:\t"<<range<<endl;   

//standard deviation
    cout<<"Standard Deviation of R: \t"<<setprecision(5)<<sqrt(variance)<<endl;
    cout<<"Variance  of R: \t"<<setprecision(5)<<variance<<endl;

     system("pause");
return 0;
}
Topic archived. No new replies allowed.