Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Inference Control In Statistical Databases From Theory To Practice Lncs 2316

Authors: Josep Domingo-Ferrer

2002nd Edition

3540436146, 978-3540436140

More Books

Students also viewed these Databases questions

Question

What is the most important principle in designing networks?

Answered: 1 week ago

Question

What are the purposes of collection messages? (Objective 5)

Answered: 1 week ago