Sleep: identifier not found

So I recently switched from c to c++ and I was trying to code a game of mash.
Everything compiles properly except It says 'Sleep': identifier not found.

Here is a snippet:

1
2
3
4
5
6
		cout << "MASH!\n\n\n";
		sleep(500);

		cout << "Enter 3 Universities: \n";
		
		uni = getstr();


Why is sleep not defined in c++? What can I use instead?
It's not defined in C either.
Are you trying to call sleep(), which I believe is a UNIX function, or Sleep(), which is a Windows API function?
I wan't my output to be delayed by half a second. I used to be able to do this in C using the sleep() function
I insist: sleep() is not, and has never been, a standard C function.
use #include <windows.h>

note S in sleep is in upper case
Last edited on
@ blackcoder41: Thank you it works now.

@ Helios: must have been my previous compiler's preset headers then
http://www.cplusplus.com/forum/unices/10491/#msg49054

You can substitute "sleep" for "delay", or whatever.

Hope this helps.
Topic archived. No new replies allowed.