Inline Code Example HereI 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?

Dude, I told you once to stick to a single thread. Initially you had two threads for this...now you've made 3!

As far as the calculations are concerned, why don't you calculate for some test cases and see if your code is giving you the same result or not?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.