Welcome
Welcome to the forums of AntiRTFM's Absolute N00b Spoonfeed C++ Tutorials!

You are currently viewing our boards as a guest, which gives you limited access to view most discussions and access our other features. By joining our free community, you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content, and access many other special features. Registration is fast, simple, and absolutely free, so please, <a href="/profile.php?mode=register">join our community today</a>!

More useful program pause [Windows only]

Display your little helpful snippets of code that may help us all get something done

More useful program pause [Windows only]

Postby Jonathan on Mon Jun 15, 2009 10:58 pm

The code will pause the program for as long as you want. To change the amount of time every loop takes you would change the # in the parenthesis after Sleep. NOTE: it is measured in miliseconds(1000 milliseconds per second). To change the amount of loops therefore the amount of periods change the # ten to whatever you want.
NOTE: you have to include the header <windows.h>.
NOTE: the 's' in sleep is in caps
Code: Select all
void end()
{
   

   for(int p = 0; p < 10; p++)
   {
      Sleep(500);
      cout << ".";
   }
}
Jonathan
 
Posts: 4
Joined: Mon Jun 15, 2009 6:19 pm
Location: Vista C.A. U.S.A.

Re: More useful program pause [Windows only]

Postby ryancfcsas on Sun Aug 23, 2009 1:53 pm

You can alos do this, which I believe is standard by using:

Code: Select all
_sleep(3000);



This I think comes under iostream.

Note: A compilier will flag this as a warning, saying it is deprecated.
A big word? I though so I looked it up it means not used anymore, discouraged.

There is also a method for Linux, which I can't remember quite now.
Don't ask about Macs, never used them, they look good, but too expensive, which is why I will probably use one.

Just Google it or find it here!
ryancfcsas
 
Posts: 2
Joined: Sun Aug 23, 2009 9:03 am


Return to Snippets

Who is online

Users browsing this forum: No registered users and 0 guests