standard deviation program

This is a discussion on standard deviation program within the C++ Programming forums, part of the General Programming Boards category; Standard Deviation Write a program that can calculate the standard deviation of a set of numbers, which were entered from ...

  1. #1
    Registered User
    Join Date
    Sep 2010
    Location
    san diego
    Posts
    1

    standard deviation program

    Standard Deviation



    Write a program that can calculate the standard deviation of a set of numbers, which were entered from the keyboard at the run time.

    The standard deviation was defined in the URL: Standard deviation - Wikipedia, the free encyclopedia .

    For calculating variance, use the formula III - On-line algorithm listed at: Algorithms for calculating variance - Wikipedia, the free encyclopedia



    Use the following data:



    Set 1


    Set 2


    Set 3


    Set 4

    11.2


    1


    8


    5

    1.3


    2


    25


    6

    2.4


    3


    7


    8

    8.5


    4


    5


    9

    7.6


    5


    8




    3.7


    6


    3




    4.8


    7


    10




    6.9


    8


    12




    5.0


    9


    9




    9.1


    10









    Required outputs:

    *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*

    Result:

    How many numbers have been read from the data file?

    Sum: of the numbers

    Mean: of the numbers

    Variance: of the numbers

    Standard Deviation: of the numbers



    *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*


    Set 1 Set 2 Set 3 Set 4
    Number of entered values 10 10 9 4
    Sum 60.5 55 87 28
    Mean 6.05 5.5 9.67 7
    Variance 9.89 9.17 40 3.33
    Standard Deviation 3.15 3.03 6.32 1.83





    can someone teach me how to start and do with this please, i get lost with the problem and dont know what do do

  2. #2
    Registered User Swarvy's Avatar
    Join Date
    Apr 2008
    Location
    United Kingdom
    Posts
    195
    Well, first of all, since you've said in your problem you will be reading the data in through a file it would probably be best writing the part of the program which loads the file and extracts the data from it. Once you've done that then calculating the standard deviation and variance should be a breeze.

    On that basis, how are the numbers in your file going to be arranged (assuming you are using a text based file)? What will you use to separate them? Commas - like in CSV files? tabs? newlines? What you use to separate the numbers determines how you should parse the file once you've opened it.

    On the flip side, out of this whole problem, opening and parsing the input file is probably the most difficult task of this assignment so do the first bit and you are on easy street.

  3. #3
    Registered User
    Join Date
    Oct 2006
    Posts
    2,590
    Quote Originally Posted by Swarvy View Post
    parsing the input file is probably the most difficult task of this assignment so do the first bit and you are on easy street.
    I agree, and even that is pretty trivial compared to many programming tasks.

    write some code and post it here if you have any trouble, and we'll try to help.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Free program I'm sharing: ConvertEnumToStrings
    By Programmer_P in forum Projects and Job Recruitment
    Replies: 101
    Last Post: 07-18-2010, 01:55 AM
  2. How to calculate standard deviation
    By hobilla in forum C Programming
    Replies: 13
    Last Post: 03-14-2009, 07:41 AM
  3. Where does the standard output go the following program
    By Overworked_PhD in forum Linux Programming
    Replies: 1
    Last Post: 02-23-2009, 08:48 PM
  4. Need help with my program...
    By Noah in forum C Programming
    Replies: 2
    Last Post: 03-11-2006, 07:49 PM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 11:04 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21