Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Online Market Research Cost Effective Searching Of The Internet And Online Databases

Authors: John F. Lescher

1st Edition

0201489295, 978-0201489293

More Books

Students also viewed these Databases questions

Question

Q.1. Health issues caused by adulteration data ?

Answered: 1 week ago

Question

1. Traditional and modern methods of preserving food Articles ?

Answered: 1 week ago

Question

What is sociology and its nature ?

Answered: 1 week ago

Question

What is liquidation ?

Answered: 1 week ago

Question

2. What are your challenges in the creative process?

Answered: 1 week ago