Sumeet6 -3 Newbie Poster

You are to write a program to test the <ctime> library from the C++
Standard library. In particular, we are interested in testing the function clock () that counts the ticks
since the program was started. It is known that this function returns different results for different C++
implementations/architectures. In this programming problem we are interested in testing this function
and producing its accuracy with statistical meaningfulness. In particular:
1. You should choose an appropriate experiment to test the function clock. Let us call this experiment
EXP. The output of EXP should be the number of ticks necessary to execute a chosen C++
command (for instance, an empty for statement that iterates for a given number of times).
2. You should determine (experimentally, i.e., through your program) the number of times that you
need to execute EXP in order to state with 95% confidence that the computed mean (average) is
within 5% of the actual mean. If you do not have a background in basic statistics, you should
search the Internet or consult fundamental text on the topic such as [1] to find out the method to
use for this purpose.
3. You should then run the experiment for that number of times and obtain the mean number of
ticks needed to execute EXP that obtains that statistical accuracy.
4. Your program should output the mean number of ticks necessary to execute EXP.
5. The following part is optional for this assignment. (It is very useful for the final project.) It will
earn you 30 extra points.
– You should present your results in a paper of at most 2 pages. The paper should describe
(and justify) what you did, namely, the chosen experiment and the way (i.e., the mathematical
formula and the rational behind it) you used to compute the number of experiment.
– The paper should also show a 2D figure depicting a curve for the average number of ticks
needed to execute EXP for increasing duration of EXP itself. You can generate the picture
with any software of your choice. The use of gnuplot orMatlab is particularly encouraged.
– The C++ code used for all the calculation should be published in the paper appendix (beyond
the 2 page limit).
Below is the framework that your should use for your program.
#include <iostream>
#include <ctime>
main ()
unsigned int n;
cout << "Insert the number of times that the experiment is to be executed: ";
cin >> n;
return 0;
Can any one help me

gerard4143 commented: Read forum rule about posting homework assignments. -3
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.