How to make a digital clock using C

The following code creates a digital clock using a 1 sec. delay. <time.h> provides various functions to delay the time.

Source Code:

Output:

 

clock

SHARE How to make a digital clock using C

You may also like...

9 Responses

  1. Anonymous says:

    it ws usefull thnx

  2. Rinkeeh says:

    Hey, Any idea how I make the clock more complicated?
    example:
    hours:
    1. 2. 3. 4. 5. 6. 7. 8. 9. 10. (11) . 12 .

    same with minutes etcetra?

  3. Anonymous says:

    Hello,

    Any idea how I change the hours, minutes and seconds into:
    Hours:
    1 . 2 . 3 . 4 . 5 . 6 . 7 . 8 . 9 . 10 . 11 . 12 . (where I highlight the current hour?) This is an assignment and im stuck

  4. Anonymous says:

    but how to show it in Linux? the is not detected with my compiler.

  5. #include
    #include

    int main()
    {
    using namespace std;

    int minutes = 0; // set the minutes
    int hours = 0; //set the hour

    Loop:
    for (int a = 0; a < 61; a++)
    {

    if (a == 60)
    {
    minutes = minutes + 1;
    a = a – 60;
    goto Loop;
    }
    if (minutes == 60)
    {
    hours = hours + 1;
    minutes = 0;
    goto Loop;
    }
    if (hours == 13)
    {
    hours = hours – hours;
    hours = hours + 1;
    }

    system("cls");
    cout <<"Hours:"<<hours<<"/ Minutes:"<<minutes<<"/ Seconds:"<<a;
    Sleep(1000);

    }

    cin.get();

    return 0;

    }

  6. debu says:

    give me the .exe file with source code.
    my id is
    [email protected]

  7. kelvowsky says:

    #include…..?

  8. kelvowsky says:

    #include……?

Leave a Reply

Your email address will not be published. Required fields are marked *

Share