Question: What is the c++ code for these questions (pseudo code provided) 1. Design the logic for a program that allows a user to enter 20

What is the c++ code for these questions (pseudo code provided)

1. Design the logic for a program that allows a user to enter 20 numbers, then displays each number and its difference from the numeric average of the numbers entered.

2. Modify the program so that the user can enter any amount of numbers up to 20 until a sentinel value is entered.

// Start

// Declarations

// num SIZE = 12

// num numbers[SIZE]

// num value = 0

// num counter = 0

// num total = 0

// num average = 0

// num diffFromAvg = 0

// num SENTINEL = -1

//

// output "Please enter a positive number: "

// input value

// while ((counter < SIZE) AND (value <> SENTINEL) )

// total = total + value

// numbers[counter] = value

// counter = counter + 1

// if (counter <> SIZE)

// output "Please enter a positive number: "

// input value

// endif

// endwhile

//

// if (counter > 0) then

// average = total/counter

// for i = 0 to counter - 1

// diffFromAvg = numbers[i] - average

// output "Number[",i,"]: ",numbers[i]," Difference from Average is ",diffFromAvg

// endfor

// else

// output "Processing incomplete. No values in the array."

// endif

// Stop

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!