Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ Program Write a program that will create an array of integer numbers with a maximum size of 50 . Then declare another variable N
C++ Program Write a program that will create an array of integer numbers with a maximum size of 50 . Then declare another variable N that represents how many actual numbers we are working with. Get an user input for N. Write a selection statement to check if N is less than 50 , if it is more than 50 , then display a message that N is crossing maximum size and ask the user to re-enter N. Now write an input statement using a loop to get N number of integer values and store in the array. Now find out the following from your program: (a) sum of all the numbers, (b) maximum value (c) minimum value and compute the average. Code must display the sum, maximum, minimum and average. Average must be a float, and it shiuld be displayed using one digit after the decimal. In order to compute the sum, maximum and minimum, do the following: Set sum =0, maximum to INT_MIN and minimum to INT_MAX Now write a loop with array index from 0 through N1 and inside the loop, use sum = sum + arrayName[i]; if (arrayName[i] > maximum) maximum = arrayName[i]; if (arrayName[i] N, make sure to convert sum to a float value, this can be done by using float(sum) Once the program works, next time change the data type for the array to a float and suitably change data types for sum, minimum, and maximum to floats and try running your program again. Must make sure to save your first program (with integers) and then change to floats. NO PDF DOCUMENT should be submitted. You must download the program files along with your results from repl (or visual studio) prior to submitting
C++ Program
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