Closed Thread
Results 1 to 6 of 6

Thread: A digital clock in Console

  1. #1
    kiekkopojka8 is offline Newbie
    Join Date
    Feb 2010
    Posts
    3
    Rep Power
    0

    A digital clock in Console

    Hey, I want to know how to make a digital clock in console appl. with hours, mins and seconds. But I don't know how.

    The funny thing is that our teacher is kinda bad so I don't get any help from him, which makes it hard to do stuff in C#.

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    cdg10620's Avatar
    cdg10620 is offline Programming Expert
    Join Date
    Jun 2009
    Location
    Texas
    Posts
    387
    Blog Entries
    3
    Rep Power
    12

    Re: A digital clock in Console

    Do you need the clock to run in the console and just display the current time? What code do you have for this so far? Can you post what you currently have?

    Quote Originally Posted by kiekkopojka8 View Post
    Hey, I want to know how to make a digital clock in console appl. with hours, mins and seconds. But I don't know how.

    The funny thing is that our teacher is kinda bad so I don't get any help from him, which makes it hard to do stuff in C#.
    -CDG10620
    Software Developer

  4. #3
    Bartimäus's Avatar
    Bartimäus is offline Programming Expert
    Join Date
    Dec 2009
    Location
    Germany
    Posts
    490
    Rep Power
    11

    Re: A digital clock in Console

    I have found an example maybe its helpful for you:
    C# Home

  5. #4
    kiekkopojka8 is offline Newbie
    Join Date
    Feb 2010
    Posts
    3
    Rep Power
    0

    Re: A digital clock in Console

    Quote Originally Posted by cdg10620 View Post
    Do you need the clock to run in the console and just display the current time?
    Yes

    Quote Originally Posted by Bartimäus View Post
    I have found an example maybe its helpful for you:
    C# Home[/url]
    Thanks, I'll check it out

  6. #5
    kiekkopojka8 is offline Newbie
    Join Date
    Feb 2010
    Posts
    3
    Rep Power
    0

    Re: A digital clock in Console

    Ok guys.

    I got this far:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    namespace ConsoleApplication1
    {
    class Program
    {
    static void Main(string[] args)
    {
    int choice = 0;

    int h = 0; /*Hours*/
    int m = 0; /*Minutes*/
    int s = 0; /*Seconds*/


    do

    {
    Console.WriteLine("My menu");
    Console.WriteLine("1- Show watch");
    Console.WriteLine("0- Close");
    Console.WriteLine("Choice: ");

    choice =Convert.ToInt32(Console.ReadLine());

    if (choice == 1)
    {
    //Show the clock
    Console.WriteLine("Clock");

    Console.ReadLine();
    }



    } while (choice != 0);

    }
    }
    }


    As you can see I did a menu where you can choose between showing the clock and close it.

    I must use System.Threading.Thread.Sleep(); and Console.Clear();

    Seconds changes to minutes and minutes changes to hours. It starts again after 12 hours.

    I've never did anything which contains these. = I need help

  7. #6
    lobo521 is offline Learning Programmer
    Join Date
    Jan 2010
    Posts
    57
    Rep Power
    8

    Re: A digital clock in Console

    Use Timer class. Timer in C#

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 0
    Last Post: 10-15-2011, 03:55 AM
  2. Updating Digital Clock Java
    By Turk4n in forum Classes and Code Snippets
    Replies: 0
    Last Post: 01-07-2010, 11:38 AM
  3. JavaScript:Tutorial, Digital Clock
    By TcM in forum JavaScript Tutorials
    Replies: 11
    Last Post: 06-04-2009, 11:30 PM
  4. A Digital Eye
    By Coldblackice in forum General Programming
    Replies: 4
    Last Post: 03-24-2009, 02:47 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts