#include <time.h> in time.h there's a function named clock() which counts cpu clocks since the beginning of your program it also contains a constant named CLOCKS_PER_SEC so if you divide clock() by CLOCKS_PER_SEC at the end of your code you'll get the running time (remember to cast the result to double to get the exact result)
cout << clock() / (double) CLOCKS_PER_SEC << endl; On Sun, Nov 8, 2009 at 9:50 AM, nikoo <shaker.far...@gmail.com> wrote: > Hi, > How can we measure running time of an algorithm on windows XP using > visual c++ ? > > Thanks > > -- > > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algoge...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > > > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.