Question: What is the C++ code for the following question? I will attach the pseudocode as well.(Please use that pseudocode) Design the logic for a program
What is the C++ code for the following question? I will attach the pseudocode as well.(Please use that pseudocode) "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."
// 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
Get step-by-step solutions from verified subject matter experts
