Question: Introduction to Programming with C++ (3rd Edition) Chapter 11, Problem 1PE (Analyze input) Write a program that first reads an integer for the array size,

Introduction to Programming with C++ (3rd Edition)

Chapter 11, Problem 1PE

(Analyze input) Write a program that first reads an integer for the array size, then reads numbers into the array, computes their average, and finds out how many numbers are above the average.

answer is not building correctly. Please help

int Prog11_1() { // Declare the variables int i,j,arraySize,sum=0,count=0,value; double average=0; // Declare the pointer variable int *numbers;

// Read the size of an array cout << "Enter array size: "; cin >> arraySize;

numbers = new int[arraySize];

cout << "Enter integer values : "; for (i = 0; i < arraySize; i++) { // Read and store numbers in an array cin >> value; *(numbers + i) = value; sum=sum+value; } // Calculate the average of the numbers average = sum/arraySize; cout << "Average number is: " ;

cout << "Above average numbers are: " <

for (j = 0; j < arraySize; j++) { if(*(numbers + j)>average) { cout<<*(numbers + j)<< " "; count++; } cout<<"Total of above average number is " < }

// Pause the system system("pause"); // Return the value return 0; }

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!