Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Visual Studio C++ Write a program that will do the following things: Create an array of datatype double with 10 elements. In one loop, generate

image text in transcribed

Visual Studio C++

Write a program that will do the following things: Create an array of datatype double with 10 elements. In one loop, generate random numbers between 20 and 80 (using a random number generator, seeded with time) and store into each element of the array. Also, in this loop, print each of the randomly generated numbers to the screen, all on a single line of output. In a separate loop, sum the values up so that you can calculate the mean(average) of the generated values. Also in this loop, determine what the smallest number generated and the largest number generated was. After this loop, calculate the average. In a third loop, calculate the Standard Deviation of the 10 values using this formula: . SD 2-1 (Ti Tavg) n where x; is one element of the array, Xavg is the mean(average) value of the array, n is equal to the number of elements(in this case 10). So, to calculate the Standard Deviation, calculate the difference of each element from the average, then square that value, and add it to the sum. Do this with each element. Once the loop is over, divide the sum by n, which in this case is 10 and take the square root of that value. . Once completed, print the mean(average)(3 decimal places), the smallest value generated(no decimal places), the largest value generated)no decimal places), and the Standard Deviation to 4 decimal places. Sample output: 53 43 64 71 45 73 72 68 73 26 The mean value is: 58.800 The smallest value generated was: 26 The largest value generated was: 73 The standard deviation of the numbers was: 15.4519 Write a program that will do the following things: Create an array of datatype double with 10 elements. In one loop, generate random numbers between 20 and 80 (using a random number generator, seeded with time) and store into each element of the array. Also, in this loop, print each of the randomly generated numbers to the screen, all on a single line of output. In a separate loop, sum the values up so that you can calculate the mean(average) of the generated values. Also in this loop, determine what the smallest number generated and the largest number generated was. After this loop, calculate the average. In a third loop, calculate the Standard Deviation of the 10 values using this formula: . SD 2-1 (Ti Tavg) n where x; is one element of the array, Xavg is the mean(average) value of the array, n is equal to the number of elements(in this case 10). So, to calculate the Standard Deviation, calculate the difference of each element from the average, then square that value, and add it to the sum. Do this with each element. Once the loop is over, divide the sum by n, which in this case is 10 and take the square root of that value. . Once completed, print the mean(average)(3 decimal places), the smallest value generated(no decimal places), the largest value generated)no decimal places), and the Standard Deviation to 4 decimal places. Sample output: 53 43 64 71 45 73 72 68 73 26 The mean value is: 58.800 The smallest value generated was: 26 The largest value generated was: 73 The standard deviation of the numbers was: 15.4519

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intermediate Accounting Reporting And Analysis, 2017 Update

Authors: James M. Wahlen, Jefferson P. Jones, Donald Pagach

2nd Edition

1337505625, 9781337505628

More Books

Students also viewed these Accounting questions

Question

Describe the major barriers to the use of positive reinforcement.

Answered: 1 week ago