Question: 1. Write a program, array.cpp, that reads in 8 double values entered by the user. It should store the values in an array. It should
1. Write a program, array.cpp, that reads in 8 double values entered by the user. It should store the values in an array. It should print the original numbers, the squares of the original numbers and the square roots of the numbers. The values should be printed in width 9 with 2 digits after the decimal. You are required to write the following functions to solve the problem: const int SIZE=8; void read_numbers (double numbers [SIZE]); void print_numbers (double numbers [SIZE]); void print_squares (double numbers [SIZE]); void print_square_roots (double numbers [SIZE]); Here is what a sample run of the program would look like (user input in bold):
Enter 8 numbers: 8.32 9.55 6 2.34 15.4 24 6.5 3.1
The numbers entered were: 8.32 9.55 6.00 2.34 15.40 24.00 6.50 3.10
The squares of the numbers are: 69.22 91.20 36.00 5.48 237.16 576.00 42.25 9.61
The square roots of the numbers are: 2.88 3.09 2.45 1.53 3.92 4.90 2.55 1.76
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
