Thread: counting down...

  1. #1
    The superhaterodyne twomers's Avatar
    Join Date
    Dec 2005
    Location
    Ireland
    Posts
    2,273

    counting down...

    Hi, I was wondering whether there was a function that would pause the program for one second. I want a program which would count down for absolutely no reason ... lol. I have something like this:


    PHP Code:
    for (i=0i<numberi++)
    {
    printf ("%d"i);
    //pausing for one second thing
    system("CLS");

    yeah, so I need something which will pause for one second ....

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    Since it seems like you're on a Windows system, you can include <windows.h> and use the Sleep function:
    Code:
    #include <windows.h>
    
    Sleep ( 1000 ); /* Pause for 1 second */
    My best code is written with the delete key.

  3. #3
    The superhaterodyne twomers's Avatar
    Join Date
    Dec 2005
    Location
    Ireland
    Posts
    2,273
    Yeah, sorry, I meant to say what kind of system I was using but forgot. cheers!!!

  4. #4
    The superhaterodyne twomers's Avatar
    Join Date
    Dec 2005
    Location
    Ireland
    Posts
    2,273
    Quote Originally Posted by Prelude
    Since it seems like you're on a Windows system, you can include <windows.h> and use the Sleep function:
    Code:
    #include <windows.h>
    
    Sleep ( 1000 ); /* Pause for 1 second */
    by the way, is it meant to be a capital S for Sleep? I was just wondering...

  5. #5
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    Yes.

  6. #6
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >by the way, is it meant to be a capital S for Sleep? I was just wondering...
    No, it's not supposed to be a capital S. I randomly throw capital letters in the middle of my sentences and in my code just to trip people up. It sUre WaS coNVenIeNt ThaT THe s wAS cApItaLizeD BOtH tIMeS.

    But seriously, I'm anal about my spelling and grammar, and even more so about my code formatting. If I use a capital letter in a function name, chances are very good that I meant to.
    My best code is written with the delete key.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Counting up(and down) using recursive function. Please help.
    By MarkSquall in forum C++ Programming
    Replies: 6
    Last Post: 06-06-2008, 04:26 AM
  2. How to implement reference counting with 'Smart_ptr'?
    By meili100 in forum C++ Programming
    Replies: 3
    Last Post: 06-10-2007, 05:28 AM
  3. Counting Numbers in Array, not counting last number!
    By metaljester in forum C++ Programming
    Replies: 11
    Last Post: 10-18-2006, 11:25 AM
  4. counting and output, with arrays and functions
    By Wraithan in forum C++ Programming
    Replies: 7
    Last Post: 12-05-2005, 12:46 AM
  5. Counting using Lib Cstring
    By niroopan in forum C++ Programming
    Replies: 4
    Last Post: 12-13-2002, 05:51 PM