Question
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started