IVE TRYED ALOT EVERYTHING ON MY OTHR THREAD "I NEED A CODE" BUT NONE OF IT WORKS! WHATS THE CODE TO PAUSE LIKE FOR 5 SECONDS FOR EX.
THANK YOU
IVE TRYED ALOT EVERYTHING ON MY OTHR THREAD "I NEED A CODE" BUT NONE OF IT WORKS! WHATS THE CODE TO PAUSE LIKE FOR 5 SECONDS FOR EX.
THANK YOU
And the cows moo...
AIM:ProdigyCpp
E-Mail:[email protected]
If you like my avatar plz dont copy it go to:
http://www.dragid.com/
#include <iostream.h>
#include <windows.h>
int main()
{
cout<<"Pauseing for 5 seconds"<<endl;
Sleep(5000); /* Notice capital 'S' in Sleep */
cout<<"Done pauseing"<<endl;
return 0;
}
Or you could try a little more elaborate variation:
#include<iostream>
#include<ctime> //or use time.h file
int main()
{
float secs = 5;
clock_t delay = secs * CLOCKS_PER_SEC; //convert to clock tics
clock_t start = clock();
while(clock() - start < delay)
;
return (0);
}
this allows more portability since you don't have to change delay when you change processor speed.
Edit: Also try using CLK_TCK or TCK_CLK instead of CLOCKS_PER_SEC.
Last edited by Traveller; 05-05-2002 at 03:54 PM.
That dont work im using a dos programOriginally posted by Dual-Catfish
#include <iostream.h>
#include <windows.h>
int main()
{
cout<<"Pauseing for 5 seconds"<<endl;
Sleep(5000); /* Notice capital 'S' in Sleep */
cout<<"Done pauseing"<<endl;
return 0;
}
And the cows moo...
AIM:ProdigyCpp
E-Mail:[email protected]
If you like my avatar plz dont copy it go to:
http://www.dragid.com/
_sleep(5); //which sleeps for 5 seconds (dos.h)
"The most common form of insanity is a combination of disordered passions and disordered intellect with gradations and variations almost infinite."
There have been about 4 reply's across your threads that should work on a DOS platform. So instead of just saying it doesn't work, and have people say the same things over and over. How about you
A) Describe what's not working (errors?)
B) Post your code (Use code tags)
C) Tell us what compiler you're using.
If you can't get a working answer first time after providing the board with that information, then you've got problems.
Yea sry ur right well it doesnt matter any more cause travellers code worked thx travellerA) Describe what's not working (errors?)
B) Post your code (Use code tags)
C) Tell us what compiler you're using.
And the cows moo...
AIM:ProdigyCpp
E-Mail:[email protected]
If you like my avatar plz dont copy it go to:
http://www.dragid.com/