This is not homework, it is rather a challenge to our professor, but I still mark it as.
The task is to create a typing game with three levels with the corresponding complexity, different time limits (in seconds) and a lot of points. Now I have no problems with the program itself, I have a problem with using a timer that should be OS independent (I assume, as the only hint says time.h about this). What I did is wrong, because this is only an approximate guess from what I read about .h time, this is also ugly code:
time_t start;
int timer = time(&start);
...
time_t current;
for(ctr=0;ctr<10;ctr++)
{
...
if(time(¤t) == (timer+40))
{
break;
}
...
}
It works sometimes, but not in most cases, because this is just an approximate guess. Any suggestions would be appreciated.