Develop a c++ program that accepts a list of a maximum of 100 voltages as input, determines both the average and standard deviation of the input voltages and then displays the results.

step 1 : requirements : an average, standard deviation

step 2: develop solution: the input is a maximum of 100 voltages (0-100) input by the user

DETERMINE THE OUTPUT:
Calculate the average by adding the voltages and dividing by the number of voltages that were added.

Determine standard deviation by:
1. subtracting the average from each individual voltage: this result in a set of new numbers, each of which is called a deviation
2. square each deviation found in the previous step
3. add the squared deviations and divide the sum by the number of deviations
4. the square root of the number found in the previous step is the standard deviation
(standard deviation is calculated by first determining the sum of the squared deviation. The standard deviation is then obtained by dividing the result sum by 10 and taking its square root)##

**CAN SOMEONE HELP ME TO WRITE A C++ PROGRAM FOR THIS? PLEEEEASE :(( **

We all can help...that's why we are here... but we don't help people who doesn't show any effort... and we don't do your homework. That's not DaniWeb.

Try to think of some logic to solve the problem and we will certainly help you build up on it.

Edited 4 Years Ago by NP-complete

Okay... I see that you've posted something on the same problem in another thread... In future try to stick to a single thread (article) for a single (or related) problem.

I revised my program

#include <iostream>
#include <cmath>
using namespace std;
int main ()


{
    const int num=100;
    float volt[num], sum=0, sum2=0 ;
    double ave2,standrddev1, standrddev2, standrddev;
    float average;
    int i, k=0 ;

    {
        cout<<"Enter the number of voltages to be analyzed:";
        cin>>k;

        if (k>100)

        {
            cout<<"Maximum of 100 voltages can only be analyzed.";
        }
    }

    while (k>100);

    for (i=0; i<k; i++)

    {
        cout<<"ENTER VOLTAGE "<<i+1<<":";
        cin>>volt[i];
        sum=sum+volt[i];

    }

        average=sum/k;
        cout<<endl<<"The average of the voltage is:"<<average<<endl;
        cout<<endl;



        for (i=0; i<k; i++)

        {
            volt[i]=pow((average-volt[i]),2);
            sum2=sum2+volt[i];
            ave2=sum2/k;
            standrddev1=(sqrt,ave2);
            standrddev2=standrddev1/k;
            standrddev=standrddev2*2;
            cout<<endl<<"The standard deviation of the voltages is:"<<standrddev<<endl;




    return 0;

        }

}

I'm just not sure if I got the correct answer/value to the question about the STANDARD DEVIATION. Is my computation correct?

This article has been dead for over six months. Start a new discussion instead.