subject

Write a program which prompts the user to enter up to 20 floating point numbers (terminated with a non-numeric), reads them into an array, then prints the following. To make it easier for you, your input is guaranteed to have at least one negative number. Make sure to test with a wide range of values. You must use an array (not a vector) to get credit. The array values in the original order, separated by a space.
The array values where every other element is reversed starting with the first one, separated by a space (see example).
Negative values, separated by a space in the same order as the original array (zero is neither positive nor negative).
The smallest number in the array.
The average of all the negative values in the array.
Example program output with user input shown in bold:

Enter a list of up to 20 integers, and a non-numeric to quit:
-8.9 1.2 -1.1 2.3 3.4 4.5 5.6 6.7 7.8 8.9 -5.0 q

The original array is: -8.9 1.2 -1.1 2.3 3.4 4.5 5.6 6.7 7.8 8.9 -5
The reversed array: -5 1.2 7.8 2.3 5.6 4.5 3.4 6.7 -1.1 8.9 -8.9
Negative values: -8.9 -1.1 -5
Smallest number: -8.9
Average of all the negative values: -5

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 24.06.2019 13:00, angelynb1497
Your mom wants to purchase a laptop computer. she said she wants her new computer to be able to play her dvds so she can listen to music and wants to know what type of optical drives will play her disk. which type of drive should she look for?
Answers: 1
image
Computers and Technology, 24.06.2019 16:50, genyjoannerubiera
Ramp charts are generally created in wordlotusexcelpowerpoint
Answers: 1
image
Computers and Technology, 24.06.2019 20:30, michell200428
Drums installed, you would apply clicks of the parking brake to obtain a slight drag on both rear wheels
Answers: 1
image
Computers and Technology, 24.06.2019 21:40, justintintran
Assume you need to test a function named inorder. the function inorder receives three int arguments and returns true if and only if the arguments are in non-decreasing order: that is, the second argument is not < the first and the third is not < the second. write the definition of driver function testinorder whose job it is to determine whether inorder is correct. so testinorder returns true if inorder is correct and returns false otherwise. for the purposes of this exercise, assume inorder is an expensive function call, so call it as few times as possible!
Answers: 1
You know the right answer?
Write a program which prompts the user to enter up to 20 floating point numbers (terminated with a n...

Questions in other subjects:

Konu
Chemistry, 20.09.2020 05:01
Konu
Chemistry, 20.09.2020 05:01
Konu
Biology, 20.09.2020 05:01
Konu
English, 20.09.2020 05:01