Hmm, i kinda aint in the mood to dig the net about this, so i guessed i'd post my question here..
I'm not so familiar with the time library...is there a nice easy way to drop some code into the loops to check which one is slowing down the program? thanks!!

Recommended Answers

All 3 Replies

Hmm, i kinda aint in the mood to dig the net about this, so i guessed i'd post my question here

In that case: I'm kinda not in the mood to give you examplecode :)
You could use GetTickCount() if you're on windows:

var = GetTickCount();
while()
end while
time = GetTickCount() - var;

voila: time in ms.

hmmm, nice, thanks alot!! but hey...windows.h aint givin me that function in dev c++...is it the compiler?

#include <ctime>

...

clock_t startTime = clock();

// your test loop goes here
for (int i=0; i<100000; i++)
    ;

clock_t endTime = clock() - startTime;

cout << "The loop took " << endTime / CLOCKS_PER_SEC << " seconds\n";
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.