I am 17 years old and I'm just getting into c and c++.
I recently wrote a timer function that, when given an
input will wait. I am here to ask all you programming wizards and witches to help me find a better way. Here's the code:
By the way, I am running Windows 8, my IDE is wxDev-C++, compiler set is Default GCC, and my compiler is MingW.Code:#include <time.h> void Tmr(int len){ int _s1; //Second 1 int _s2; //Second 2 int _lc; //loop count while(_lc != len){ _s1 = time(NULL); if(_s1 != _s2){ _lc = _lc + 1; _s2 = time(NULL); } } } int main() { Tmr(10); //ten seconds or so }