Hi, I asked my computer programming teacher if there was a way to slow a loop down...she said yes but she wasn't sure how...can someone here tell me how to slow the loop down...so I can make it loop every 5 seconds etc... Thanks
-Nick
Printable View
Hi, I asked my computer programming teacher if there was a way to slow a loop down...she said yes but she wasn't sure how...can someone here tell me how to slow the loop down...so I can make it loop every 5 seconds etc... Thanks
-Nick
this is os specific and sometimes compiler specific too.
I have used sleep() from dos.h
Sleep() from windows.h
some compilers also offer a delay() function. Check for those in your helpfiles.
I am fairly new at this code so can you include a sample code
Thanks I appreciate it. :)
not tried it.Code:#include<windows.h>
#include<iostream>
using namespace std;
int main()
{
cout<<"This should appear straight away"<<endl;
Sleep(5000); // millisecs
cout<<"This should appear roughly 5 secs after"<<endl;
return 0;
}
it worked ...but whats this "using namespace std;" that gave me an error so I took it out and it worked. What does that do?
Thanks for the code
-Nick