Hi, I want to create a Hangman game with timer..
If the user cannot guess the word with in 1:30 min the game will stop and the word will be printed.
Can you help me to create the timer..
Thanks
Hi, I want to create a Hangman game with timer..
If the user cannot guess the word with in 1:30 min the game will stop and the word will be printed.
Can you help me to create the timer..
Thanks
Are you still using TurboCrap?
Or is this a whole new guessing game.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
You might try usleep() with an incrementing variable to visually time it. You will have to loop it. usleep() uses micro seconds so usleep(1000000) is one second. And you have to #include<unistd.h>..
Hope this helps!!
Something different:
Go here, and d/l the timer program:
Orzeszek Timer
Rename it OrzTimer.exe
in a plain text editor, create the run.bat file, with:
@echo off
OrzTimer.exe 15 seconds
and save it into the same directory where this
program will be placed.Change the seconds in
the bat file to suit your needs.
Start it, right click the center of the window
and select "options". Set it to close when done.
Compile and run this program.
Code:#include <stdio.h> #include <process.h> int main (){ int i; _spawnl(_P_NOWAIT, "run.bat", NULL); for(i=0;i<14;i++) { printf("%Your game code goes in here\n",i); _sleep(1); } printf("\n"); return 0; }
I would guess that the OP wants to be able to type in guesses whilst the timer is counting down, rather than just blocking for some specified time and then saying "game over", whilst the user furiously pounded the keyboard to an unresponsive program.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.