Returning Actual Seconds

This is a discussion on Returning Actual Seconds within the C++ Programming forums, part of the General Programming Boards category; I'm trying to code a small program that acts as a 'quasi' timer. In the middle of the screen I ...

  1. #1
    Unregistered
    Guest

    Returning Actual Seconds

    I'm trying to code a small program that acts as a 'quasi' timer.

    In the middle of the screen I need the Time HH:MM:SS
    to be refreshed every second. Starting at 00:00:00.

    Any ideas on where to begin ?
    Or does anyone have some sample code
    they wouldn't mind sharing.

    ..This Program is out of Curiosity..

  2. #2
    Unregistered
    Guest
    Code:
    #include <iostream>
    using std::cout;
    
    #include <unistd.h>
    
    int main ()
    {
        int sec = 0;
       
        while (1) {
            cout << sec++ << '\r';
            sleep (1);
        }
      
         return 0;
    }
    that's one easy way to count seconds. i'm sure there's a way to sleep with windows. i just can't remeber the header file. that should get your started, right?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to build a timer that counts the seconds elapsed?
    By Nazgulled in forum C Programming
    Replies: 17
    Last Post: 05-28-2007, 01:26 PM
  2. Problem with simple case statements
    By shoobsie in forum C Programming
    Replies: 2
    Last Post: 05-08-2006, 09:39 AM
  3. Please Help - Problem with Compilers
    By toonlover in forum C++ Programming
    Replies: 5
    Last Post: 07-23-2005, 11:03 AM
  4. Time to seconds program
    By Sure in forum C Programming
    Replies: 1
    Last Post: 06-13-2005, 09:08 PM
  5. returning a value with char
    By kashifk in forum C++ Programming
    Replies: 5
    Last Post: 07-14-2003, 08:28 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21