Question: Write a C++ program, where you calculate the subprogram performance of a global static array and local array with same size, same content. To accomplish

 Write a C++ program, where you calculate the "subprogram performance" of

Write a C++ program, where you calculate the "subprogram performance" of a global static array and local array with same size, same content. To accomplish this, declare a static global integer array with size 500000 . Then, inside of your main declare another integer array with the same size. After that, fill both arrays with the numbers starting from 0 to 500000 . Later, declare a function that takes an array as a parameter and returns nothing. In the function update the values in the array with multiplying them by 100 . Also, print each element on the screen. Lastly, your job is to run the function you have declared twice. First with the local array as parameter and then once more with second array as parameter. You need to measure the time elapsed at each function run. Print the difference between measured times and see which array makes the function run faster. To measure elapsed time in function execution you may refer: https://www.geeksforgeeks.org/measure-execution-time-function-cpp/

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!