Question
Please write a c++ code with proper use of constants for my pseudo code. I am take a class that is teaching me flow charts
Please write a c++ code with proper use of constants for my pseudo code. I am take a class that is teaching me flow charts and pseudocode and I would like to see the actual code so that I can start preparing myself for next semesters classes. Here is the pseudo code:
// main module
Module main()
// Local variables
Constant Integer SIZE = 20
Declare Integer numbers[SIZE], high, low, average, total = 0
// Get numbers
For index = 0 to SIZE - 1
Display Enter number , index + 1, :
Input numbers[index]
End For
// Get statistics
For index = 0 to SIZE 1
Set total = total + numbers [index]
If index == 0 Then
Set high = numbers [index]
Set low = numbers [index]
End If
If high < numbers [index] Then
Set high = numbers [index]
End If
If low > numbers [index] Then
Set low = numbers [index]
End If
End For
Set average = total / SIZE
// Show statistics
Call showStats(high, low, total, average)
End Module
// The showStats module shows high, low, average number
Module showStats(Integer high, low, total, average)
Display High number is: , high
Display Low number is: , low
Display Total of numbers is: , total
Display Average of numbers is: , average
End Module
Output should like this:
THIS PROBLEM IS MODIFIED AS FOLLOWS:
DO NOT ASK FOR THE USER TO ENTER 20 NUMBERS.
Instead, initialize an array with these specific 20 numbers: 26 45 56 12 78 74 39 22 5 90 87 32 28 11 93 62 79 53 22 51
The array was initialized to: 26 45 56 12 78 74 39 22 5 90 87 32 28 11 93 62 79 53 22 51 The lowest number is: 5 The highest number is: 93 The total of the numbers is: 965 The average of the numbers is: 48.25
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