1

I've searched over the internet for a function that can "hold" my program..

I've seen the function sleep(), though it does not work for me, saying it is undeclared.. (I have included stdlib.h/time.h/iostream)

I do not have parrel stuff that are working in the side, so even if I stop the whole program, that's okay..

for example :

sleep(3000) cout << "Hello World";

Thanks!

AmitM9S6
  • 131
  • 2
  • 13
  • Try this dude: http://stackoverflow.com/questions/4184468/sleep-for-milliseconds Read it. Hint: Look for usleep. – user1833028 Dec 12 '12 at 10:18

3 Answers3

2

If you are using c++11 you have a portable way to suspend your thread: http://en.cppreference.com/w/cpp/thread/sleep_for

otherwise you have to include Windows.h to use Sleep: http://msdn.microsoft.com/en-us/library/windows/desktop/ms686298%28v=vs.85%29.aspx

Tobias Hermann
  • 9,936
  • 6
  • 61
  • 134
1

try this.

usleep(microseconds) 

1000 microseconds in a millisecond

You may need to: #include <unistd.h>

LukeStoneHm
  • 122
  • 10
1

Try "Sleep" with a capital S..... and #include winbase.h

Liam
  • 1,472
  • 1
  • 10
  • 14