THIS IS ABOUT C++

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

THIS IS ABOUT C++

Post by answerhappygod »

THIS IS ABOUT C++
This Is About C 1
This Is About C 1 (168.18 KiB) Viewed 100 times
Lab 10 - Pointers and Dynamic Memory Allocation Movie Data Write a program that will be used to gather statistical data about the number of movies college students see in a month. The program should ask the user how many students were surveyed and dynamically allocate an array of that size. The program then should allow the user to enter the number of movies each student has seen. It should then sort the scores and calculate the average. Modularity: Main: The main function should accept the number of students from the user and dynamically create an array large enough to contain number of movies watched for each student. Input validation: The number of students should be a positive integer. Print the average and free the allocated array when complete. Get the data. This function should get the number of movies watched by each college student. Input validation: The number of movies should be a positive integer. Sort the data. This function should sort the array in ascending order. Note you may use the Standard Template Library sort function or your own sort function. To use the STL sort: • Add #include <algorithm> to your program o sort (arrayname, arrayname + size of array) (beginning and ending elements) Display: This function should display the sorted list of the number of movies watched. Average: This function should be a value-returning function that calculates the average of the movies watched and returns it to the main function. Sample Output: Number of Movies Watched 75 81 88 Average 81.3 Requirements: Your array must be dynamically allocated. In passing your array to functions, you must declare the array parameter using pointer notation instead of array notation, and inside each function you must use pointer notation instead of array notation to access the array elements.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply