Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
loop iterations
Name: saddam (by lurker) Date: February 11, 2004 at 15:36:35 Pacific OS: Windows XP
Comment:
Have anyone wondered how many iterations can a forloop run in a second? It does a simple task like:
for(int i = 0; i < some_value; i++) printf("%d ", i);
Name: StuartS Date: February 11, 2004 at 17:16:15 Pacific
Reply:
Time It. Put a GeTickCount API at the beginning. Store the value. Get another one at the end and calculate the difference. The answer is in Milli seconds but will only have an resolution of 15 Milli seconds.
GetTickCount returns the number of milli seconds since the computer was started.
Public Declare Function GetTickCount Lib "kernel32" Alias "GetTickCount" () As Long
Stuart
Stuart
0
Response Number 2
Name: saddam (by lurker) Date: February 12, 2004 at 00:55:06 Pacific
Reply:
Hi Stuart,
thank you for that (useful?) information. however, that is in VB not C
saddam
0
Response Number 3
Name: StuartS Date: February 12, 2004 at 01:34:13 Pacific
Reply:
Well try this then:
DWORD GetTickCount( void );
Stuart
Stuart
0
Response Number 4
Name: saddam (by lurker) Date: February 13, 2004 at 00:52:40 Pacific
Reply:
"at the beginning"
is that before the loop and the end out of the loop or within the loop?
Summary: NO s--- MAN IT WORKS! I'm glad to see we're in agreement! ...I asked it here because I hoped to get clearlier answer. An easy way to clear the console, which will work regardless of the platform is to...
Summary: for (n=0; n = 0; j--) { tmpstrg[j] = *pSentence; ++pSentence; } This loop appears messed up. Assuming that you meant the middle section to be "n ==0" rather than "n = 0" (there is a major difference)...
Summary: Hi everyon, I am working on a program that encrypts 4 letter word, and I am testing it, when I out the original message it outputs well but when I output the encryppted message it display the encrypt...