Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

WRITE A PROGRAM that counts the number of negative values, the number of positive values and the number of zeros in a float array. Specificially,

WRITE A PROGRAM that counts the number of negative values, the number of positive values and the number of zeros in a float array. Specificially, the program should: greet the user, prompt for and input the length of the array; idiotproof the length of the array; dynamically allocate the array; check that the allocation was successful; prompt for and input the values in the array; count the number of negative values; count the number of positive values; count the number of zeros; output the numbers of negative, positive and zero values in the array; deallocate the array. HINT: To determine how many of the input values have a particular property, you need to examine each value in turn to see whether it has that property. Specifically: 1. Before you start examining the input values, the number of input values that youve examined so far that have that property is zero. 2. Examine each input value in turn. If it has the property, then the number of input values that youve examined so far that have that property increases by one. NOTE: You MUST calculate each of the three counts in its own for loop; you are ABSOLUTELY FORBIDDEN to calculate more than one of them in the same for loop.

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

Spomenik Monument Database

Authors: Donald Niebyl, FUEL, Damon Murray, Stephen Sorrell

1st Edition

0995745536, 978-0995745537

More Books

Students also viewed these Databases questions

Question

What is the Definition for Third Normal Form?

Answered: 1 week ago

Question

Provide two examples of a One-To-Many relationship.

Answered: 1 week ago