Reputation: 7
I have two functions and I want to print how long each of them took to finish.
What I have so far:
int main()
{
clock_t tic1 = clock();
shell_sort(array, 100000);
clock_t toc1 = clock();
printf("shellsort took: %f seconds\n", (double)(toc1 - tic1) / CLOCKS_PER_SEC);
clock_t tic2 = clock();
bubble_sort(array, 100000);
clock_t toc2 = clock();
printf("bubblesort took: %f seconds\n", (double)(toc2 - tic2) / CLOCKS_PER_SEC);
return 0;
}
It should work fine, but after printing duration of first function it stops. It feels like the program is still running. There is no "Press any key to continue". How can I fix this?
Upvotes: 0
Views: 36