int a;
unsigned t0=clock(),t1;
std::cin >>a;
t1=clock()-t0;
On Linux, t1 will always equal zero. clock() returns how much processor time the process has used since it started.
On Windows, the value of t1 depends on how long the user took to enter something. clock() returns how how much time has passed since the process started.
EDIT: Furthermore, I have not idea how clock() behaves in multithreaded applications.
uhn...
i think i got the difference
but i need to get the execution time of the program, like the "time" command in linux...
there is a way of doing it?
You have already been given the answer twice -- the second time with a working example. If you want more information, read the manual: http://linux.die.net/man/7/time