c++ - formatting clock_t variables to show as real time -


i looking solution project working on right need display clock time of sorting algorithms in clock ticks , real time. seems i've got things setup ok, when displaying clock ticks , actual time can't actual time display 3 places after decimal. here code have setup clock stuff (with necessary header files)

// beginning time     beginning = clock(); // --- function clocked --- // ending time     ending = clock();  // set clock variables     elapsed = ending - beginning;     totaltime = (elapsed / clk_tck); 

some of data coming out looking when go display cout,

number of items - elapsed clock - elapsed time

100000 - 11400 - 11

where want this,

number of items - elapsed clock - elapsed time

100000 - 11401 - 11.401

sorry know formatting question awful. have advice?

#define __clock_t_type      __syscall_slong_type 

so clock() gives long , want double... maybe som type cast here.


Comments

Popular posts from this blog

How to connect android app to App engine -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

php - display validation error message next to the textbox in codeigniter -