Texts:
1) Write a C++ program that contains a loop that will calculate the sum(i*0.75) from 1 up to n, where n is sufficiently large to require about 30 seconds to complete. You might want to use nested loops.
(You can find out how long a program takes by using the LINUX time command). The program should not require any input nor generate any output except possibly at the end. Include comments to describe the program and identify yourself as the author of the program.
• Use the LINUX time command to execute your program as a foreground process and time it.
Example: time program1
• Use "&" to execute the program as a background process several times.
Example: programName&
(use "time" to measure it as well)
• Use the ps command to monitor its execution in the background.
2) Create two more C++ programs, similar to the above program, except that they take about 75 and 120 seconds respectively to execute. (3 in total: 30, 75, and 120 seconds)
with the following commands:
-time:
-Outputs 3 separate time indicators
-Real time, user time, and sys time
-User time: time the program spent executing user functions, e.g., loops or indexing user-defined arrays
-Sys time: time the program spent executing system functions, like memory allocations, variable setups, loading libraries, call system utilities.
-Real time: total time the program was running, from start to finish, similar if you used a stopwatch to time the program.