When I got no help I tried my own…
did not see 2 messages above this
I realized that all the tutorials loop the one part of the code forever…
Exactly. And you figured it out on your own, so you’ll better understand it now than if you had just been blindly using something that was given to you. As for creating a timing mechanism, there are several options.
You can use the C time function which will give you 1 second precision, or in Windows, you can use timeGetTime which has millisecond precision. That’s usually good enough, but if you want to get microsecond precision, you can do so in Windows with QueryPerformanceCounter and QueryPerformanceFrequency, or in asemmbly on the x86 processors (Pentium and up) by using the rdtsc op-code.