Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program that can be used to gather statistical data about the number of movies college students see in a month. The program should

Write a program that can be used to gather statistical data about the number of movies college students see in a month. The program should perform the following steps:

1)Ask the user how many students were surveyed (not less than zero).

2)An array of integers the size of the number of students should be dynamically allocated.

3)Allow the user to enter the number of movies each student saw into the array (between 0 and 100, inclusive).

4)Calculate the average of the values entered.

Display the result

Notes:

Whenever accessing dyn_array, use pointer notation in place of regular square array brackets.

Use the following skeleton for the main program:

int main() { int *dyn_array; int students; float avrg; do { cout << "How many students will you enter? "; cin >> students; }while ( students <= 0 ); dyn_array = create_array( students ); //this function creates a dynamic array //and returns its pointer enter_data( dyn_array, students ); //use 'pointer' notation in this function to //access array elements //accept only numbers 0-100 for movie seen avrg = find_average( dyn_array, students ); //use 'pointer' notation in this function to //access array elements cout << "The array is:" << endl << endl; show_array( dyn_array, students); cout << endl; cout << "The average is " << avrg << ". "; delete [] dyn_array; 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_2

Step: 3

blur-text-image_3

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

Advanced MySQL 8 Discover The Full Potential Of MySQL And Ensure High Performance Of Your Database

Authors: Eric Vanier ,Birju Shah ,Tejaswi Malepati

1st Edition

1788834445, 978-1788834445

Students also viewed these Databases questions