69,373
社区成员
发帖
与我相关
我的任务
分享
#include <stdio.h>
#include <time.h>
int main(void)
{
int num;
scanf("%d", &num);
printf("%d\n", num);
printf("Time used = %.2f\n", (double)clock() / CLOCKS_PER_SEC);
return 0;
}
The clock() function returns an approximation of processor time used by the program.
RETURN VALUE
The value returned is the CPU time used so far as a clock_t; to get the number of seconds used, divide by CLOCKS_PER_SEC. If the processor time used is not available or its value cannot be represented, the function returns the value (clock_t)-1.
#include <stdio.h>
#include <time.h>
int main(void)
{
int num;
scanf("%d", &num);
printf("%d\n", num);
printf("Time used = %.2f\n", (double)clock() / CLOCKS_PER_SEC);
system("pause");
return 0;
}