How do I make my program to count secods... something like a timeout?
12 11 10 9 8 7 6 5 4 3 2 1 ... and then something happens..
But how do I make it to show the numbers ?
Thank you in advance!
How do I make my program to count secods... something like a timeout?
12 11 10 9 8 7 6 5 4 3 2 1 ... and then something happens..
But how do I make it to show the numbers ?
Thank you in advance!
Ilia Yordanov,
http://www.cpp-home.com ; C++ Resources
The sleep function is whatever your compiler / OS combination allows for sleeping for a second.Code:#include <iostream> int main ( ) { for ( int i = 10 ; i >= 0 ; i-- ) { cout << i << " " << flush; sleep( 1 ); } return 0; }
I believe the FAQ has some ideas
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.
It ain't work... "sleep" undeclared identifer
Ilia Yordanov,
http://www.cpp-home.com ; C++ Resources
As Salem said...
>>>
The sleep function is whatever your compiler / OS combination allows for sleeping for a second.´
<<<
... this does tend to be compiler/OS specific. To acheive this with VC++ for example you would use Sleep(1000); with a capital S and in milliseconds. I think Borland use wait().
Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.