SOURCE CODE FOR DIGITAL CLOCK IN C LANGUAGE

Discussion in 'C Programming' started by mohsinalishah444@hotmail.com, Jun 14, 2007.

  1. Guest

    Dear All,
    PLZ TELL ME THE SOURCE CODE OF DIGITAL CLOCK IN
    C LANGUAGE . I REALLY NEED IT AND I DONOT KNOW HOW TO USE C LANGUAGE .
    ACTUALLY I WANT TO MAKE A CLOCK IN LINUX >IF ANY BODY POST ME THE
    CODE I HALL BEW VERY THANKFUL TO HOM> PLZ DO REPLY ME PLZ
    , Jun 14, 2007
    #1
    1. Advertising

  2. Ian Collins Guest

    wrote:
    > Dear All,
    > PLZ TELL ME THE SOURCE CODE OF DIGITAL CLOCK IN
    > C LANGUAGE . I REALLY NEED IT AND I DONOT KNOW HOW TO USE C LANGUAGE .
    > ACTUALLY I WANT TO MAKE A CLOCK IN LINUX >IF ANY BODY POST ME THE
    > CODE I HALL BEW VERY THANKFUL TO HOM> PLZ DO REPLY ME PLZ
    >

    DON'T SHOUT!

    Unless you are using a teletype.

    --
    Ian Collins.
    Ian Collins, Jun 14, 2007
    #2
    1. Advertising

  3. On Thu, 14 Jun 2007 02:29:43 -0700, in comp.lang.c ,
    wrote:

    >Dear All,
    > PLZ TELL ME THE SOURCE CODE OF DIGITAL CLOCK IN
    >C LANGUAGE . I REALLY NEED IT AND I DONOT KNOW HOW TO USE C LANGUAGE .
    > ACTUALLY I WANT TO MAKE A CLOCK IN LINUX >IF ANY BODY POST ME THE
    >CODE I HALL BEW VERY THANKFUL TO HOM> PLZ DO REPLY ME PLZ


    TypinG ENTIRELY IN UPPERCASE is regarded as shouting on usenet. You
    should use normal sentence case.

    As for the question, this isn't comp.sources.wanted. If you try to
    write the programme yourself first, then people will be happy to show
    where you've gone wrong.

    If you want some hints, look at the time() and mktime() functions and
    the various structs associated with them. These will get you started.

    --
    Mark McIntyre

    "Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are,
    by definition, not smart enough to debug it."
    --Brian Kernighan
    Mark McIntyre, Jun 14, 2007
    #3
  4. <> wrote in message
    news:...
    > Dear All,
    > PLZ TELL ME THE SOURCE CODE OF DIGITAL CLOCK IN
    > C LANGUAGE . I REALLY NEED IT AND I DONOT KNOW HOW TO USE C LANGUAGE .
    > ACTUALLY I WANT TO MAKE A CLOCK IN LINUX >IF ANY BODY POST ME THE
    > CODE I HALL BEW VERY THANKFUL TO HOM> PLZ DO REPLY ME PLZ
    >


    #include <stdio.h>

    #define PUTS puts
    #define MAIN main
    #define INT in

    INT MAIN()
    {
    PUTS("THE TIME IS NOW 4:41PM, MIGHT BE INCORRECT THOUGH");
    }
    Serve Laurijssen, Jun 14, 2007
    #4
  5. Serve Laurijssen wrote:
    >
    > <> wrote in message
    > news:...
    > > Dear All,
    > > PLZ TELL ME THE SOURCE CODE OF DIGITAL CLOCK IN
    > > C LANGUAGE . I REALLY NEED IT AND I DONOT KNOW HOW TO USE C LANGUAGE .
    > > ACTUALLY I WANT TO MAKE A CLOCK IN LINUX >IF ANY BODY POST ME THE
    > > CODE I HALL BEW VERY THANKFUL TO HOM> PLZ DO REPLY ME PLZ
    > >

    >
    > #include <stdio.h>
    >
    > #define PUTS puts
    > #define MAIN main
    > #define INT in

    s/in/int/
    >
    > INT MAIN()
    > {
    > PUTS("THE TIME IS NOW 4:41PM, MIGHT BE INCORRECT THOUGH");
    > }



    ITYM:


    #define STDIO <stdio.h>
    #define PUTS(TEXT) puts(TEXT);
    #define MAIN main(void)
    #define INT int
    #define BEGIN {
    #define END }
    #define CLOCK "THE TIME IS NOW 12:06PM, MIGHT BE INCORRECT THOUGH"

    /************* BEGIN MAIN PROGRAM *************/

    #include STDIO

    INT MAIN BEGIN PUTS(CLOCK) END


    --
    +-------------------------+--------------------+-----------------------+
    | Kenneth J. Brody | www.hvcomputer.com | #include |
    | kenbrody/at\spamcop.net | www.fptech.com | <std_disclaimer.h> |
    +-------------------------+--------------------+-----------------------+
    Don't e-mail me at: <mailto:>
    Kenneth Brody, Jun 14, 2007
    #5
  6. Lew Pitcher Guest

    On Jun 14, 12:06 pm, Kenneth Brody <> wrote:
    > Serve Laurijssen wrote:
    >
    > > <> wrote in message
    > >news:...
    > > > Dear All,
    > > > PLZ TELL ME THE SOURCE CODE OF DIGITAL CLOCK IN
    > > > C LANGUAGE . I REALLY NEED IT AND I DONOT KNOW HOW TO USE C LANGUAGE .
    > > > ACTUALLY I WANT TO MAKE A CLOCK IN LINUX >IF ANY BODY POST ME THE
    > > > CODE I HALL BEW VERY THANKFUL TO HOM> PLZ DO REPLY ME PLZ

    >
    > > #include <stdio.h>

    >
    > > #define PUTS puts
    > > #define MAIN main
    > > #define INT in

    > s/in/int/
    >
    > > INT MAIN()
    > > {
    > > PUTS("THE TIME IS NOW 4:41PM, MIGHT BE INCORRECT THOUGH");
    > > }

    >
    > ITYM:
    >
    > #define STDIO <stdio.h>


    /*> #define PUTS(TEXT) puts(TEXT); */

    /* perhaps a bit "better" form. at least safe from embedded escape
    sequences */
    #define PUTS(TEXT) puts("%s\n",TEXT);

    > #define MAIN main(void)
    > #define INT int
    > #define BEGIN {
    > #define END }
    > #define CLOCK "THE TIME IS NOW 12:06PM, MIGHT BE INCORRECT THOUGH"
    >
    > /************* BEGIN MAIN PROGRAM *************/
    > #include STDIO */
    > INT MAIN BEGIN PUTS(CLOCK) END
    Lew Pitcher, Jun 14, 2007
    #6
  7. Lew Pitcher Guest

    On Jun 14, 12:50 pm, Lew Pitcher <> wrote:
    > On Jun 14, 12:06 pm, Kenneth Brody <> wrote:
    >
    >
    >
    > > Serve Laurijssen wrote:

    >
    > > > <> wrote in message
    > > >news:...
    > > > > Dear All,
    > > > > PLZ TELL ME THE SOURCE CODE OF DIGITAL CLOCK IN
    > > > > C LANGUAGE . I REALLY NEED IT AND I DONOT KNOW HOW TO USE C LANGUAGE .
    > > > > ACTUALLY I WANT TO MAKE A CLOCK IN LINUX >IF ANY BODY POST ME THE
    > > > > CODE I HALL BEW VERY THANKFUL TO HOM> PLZ DO REPLY ME PLZ

    >
    > > > #include <stdio.h>

    >
    > > > #define PUTS puts
    > > > #define MAIN main
    > > > #define INT in

    > > s/in/int/

    >
    > > > INT MAIN()
    > > > {
    > > > PUTS("THE TIME IS NOW 4:41PM, MIGHT BE INCORRECT THOUGH");
    > > > }

    >
    > > ITYM:

    >
    > > #define STDIO <stdio.h>

    >
    > /*> #define PUTS(TEXT) puts(TEXT); */
    >
    > /* perhaps a bit "better" form. at least safe from embedded escape
    > sequences */
    > #define PUTS(TEXT) puts("%s\n",TEXT);


    Gaak! Ignore that. I misread puts() as printf(). Sorry
    Lew Pitcher, Jun 14, 2007
    #7
  8. wrote:
    > PLZ TELL ME THE SOURCE CODE OF DIGITAL CLOCK IN
    > C LANGUAGE . I REALLY NEED IT AND I DONOT KNOW HOW TO USE C LANGUAGE .
    > ACTUALLY I WANT TO MAKE A CLOCK IN LINUX >IF ANY BODY POST ME THE
    > CODE I HALL BEW VERY THANKFUL TO HOM> PLZ DO REPLY ME PLZ
    >

    Stop shouting. We can hear you, even back here in the cheap seats.

    Go find "grdc", available in any BSD code repository. Should port to
    Linux easily (if it hasn't already been ported).
    --
    clvrmnky <mailto:>

    Direct replies will be blacklisted. Replace "spamtrap" with my name to
    contact me directly.
    Clever Monkey, Jun 14, 2007
    #8
  9. shadowman Guest

    wrote:
    > Dear All,
    > PLZ TELL ME THE SOURCE CODE OF DIGITAL CLOCK IN
    > C LANGUAGE . I REALLY NEED IT AND I DONOT KNOW HOW TO USE C LANGUAGE .
    > ACTUALLY I WANT TO MAKE A CLOCK IN LINUX >IF ANY BODY POST ME THE
    > CODE I HALL BEW VERY THANKFUL TO HOM> PLZ DO REPLY ME PLZ
    >


    /bin/date
    shadowman, Jun 14, 2007
    #9
  10. Chris Hills Guest

    In article <>, Ian Collins
    <> writes
    > wrote:
    >> Dear All,
    >> PLZ TELL ME THE SOURCE CODE OF DIGITAL CLOCK IN
    >> C LANGUAGE . I REALLY NEED IT AND I DONOT KNOW HOW TO USE C LANGUAGE .
    >> ACTUALLY I WANT TO MAKE A CLOCK IN LINUX >IF ANY BODY POST ME THE
    >> CODE I HALL BEW VERY THANKFUL TO HOM> PLZ DO REPLY ME PLZ
    >>

    >DON'T SHOUT!
    >
    >Unless you are using a teletype.
    >

    Is that a sort of teletubby?

    --
    \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    \/\/\/\/\ Chris Hills Staffs England /\/\/\/\/
    /\/\/ www.phaedsys.org \/\/\
    \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
    Chris Hills, Jun 14, 2007
    #10
  11. "CBFalconer" <> wrote in message
    news:...
    > Serve Laurijssen wrote:
    >> <> wrote in message
    >>
    >>> PLZ TELL ME THE SOURCE CODE OF DIGITAL CLOCK IN C LANGUAGE . I
    >>> REALLY NEED IT AND I DONOT KNOW HOW TO USE C LANGUAGE . ACTUALLY
    >>> I WANT TO MAKE A CLOCK IN LINUX >IF ANY BODY POST ME THE CODE I
    >>> HALL BEW VERY THANKFUL TO HOM> PLZ DO REPLY ME PLZ

    >>
    >> #include <stdio.h>
    >>
    >> #define PUTS puts
    >> #define MAIN main
    >> #define INT in
    >>
    >> INT MAIN()
    >> {
    >> PUTS("THE TIME IS NOW 4:41PM, MIGHT BE INCORRECT THOUGH");
    >> }

    >
    > Fails miserably. 'in' is not a valid type. main fails to return a
    > value. :)


    No return value from main is defined :p
    Serve Laurijssen, Jun 15, 2007
    #11
  12. Hyuga Guest

    On Jun 14, 5:29 am, wrote:
    > Dear All,
    > PLZ TELL ME THE SOURCE CODE OF DIGITAL CLOCK IN
    > C LANGUAGE . I REALLY NEED IT AND I DONOT KNOW HOW TO USE C LANGUAGE .
    > ACTUALLY I WANT TO MAKE A CLOCK IN LINUX >IF ANY BODY POST ME THE
    > CODE I HALL BEW VERY THANKFUL TO HOM> PLZ DO REPLY ME PLZ


    Not to indulge, but here's THE SOURCE CODE OF DIGITAL CLOCK IN C
    LANGUAGE FOR LINNOCKS!!!!

    #include <unistd.h>
    int main(void) {
    execv("/bin/date", NULL);
    return 0;
    }

    Enjoy!

    Hyuga
    Hyuga, Jun 15, 2007
    #12
  13. Guest

    dear all
    i try to build the digital clock but it has some problems
    and errors plz remove those erros and help me . i am sending the code
    plz debug it

    i shall be very thankful to u for this act of kindness


    the code is as below

    #include<conio.h>
    #include<stdio.h>
    #include<graphics.h>
    using System;
    using System.WinForms;
    using System.Drawing;
    using System.Drawing.Drawing2D;
    using System.Drawing.Imaging;
    public class h2:Form
    {
    private Image []image=new Bitmap[10];
    private Image colon=null;
    Timer t=new Timer();
    Rectangle rec=new Rectangle(50,50,100,100);
    h2()
    {
    for(int x=0;x<10;x++)
    image[x]=new Bitmap(x+".gif");
    colon=new Bitmap("colon.gif");
    this.Size=new Size(350,50);
    this.BorderStyle=FormBorderStyle.None;
    this.BackgroundImage=new Bitmap("back5.gif");
    this.StartPosition=FormStartPosition.Manual;
    this.DesktopLocation=new Point(400,0);
    this.ShowInTaskbar=false;
    this.TopMost=true;
    this.Opacity=0.50;
    t.Interval=1000;
    t.Tick+=new EventHandler(draw1);
    t.Enabled=true;
    }
    protected override void OnPaint(PaintEventArgs a)
    {
    Graphics g=a.Graphics;
    int hh=DateTime.Now.Hour;
    int hh1=hh/10;
    int hh2=hh%10;
    g.DrawImage(image[hh1],0,1,40,40);
    g.DrawImage(image[hh2],40,1,40,40);
    g.DrawImage(colon,80,5,30,30);
    int mm=DateTime.Now.Minute;
    int mm1=mm/10;
    int mm2=mm%10;
    g.DrawImage(image[mm1],115,1,40,40);
    g.DrawImage(image[mm2],155,1,40,40);
    g.DrawImage(colon,195,5,30,30);
    int ss=DateTime.Now.Second;
    int ss1=ss/10;
    int ss2=ss%10;
    g.DrawImage(image[ss1],230,1,40,40);
    g.DrawImage(image[ss2],285,1,40,40);
    }
    public void draw1(object ob,EventArgs a)
    {
    this.Invalidate();
    }
    public static void Main()
    {
    Application.Run(new h2());
    }
    }
    , Jun 20, 2007
    #13
  14. said:

    > dear all
    > i try to build the digital clock but it has some problems
    > and errors plz remove those erros and help me . i am sending the code
    > plz debug it


    I've removed all the errors, as you asked. There's nothing left.

    --
    Richard Heathfield
    "Usenet is a strange place" - dmr 29/7/1999
    http://www.cpax.org.uk
    email: rjh at the above domain, - www.
    Richard Heathfield, Jun 20, 2007
    #14
  15. Chris Dollin Guest

    wrote:

    > dear all
    > i try to build the digital clock but it has some problems
    > and errors plz remove those erros and help me . i am sending the code
    > plz debug it


    fr gdz sk dn't brvt lk tht -- ts hrd t rd.

    > i shall be very thankful to u for this act of kindness
    >
    >
    > the code is as below
    >
    > #include<conio.h>
    > #include<stdio.h>
    > #include<graphics.h>
    > using System;
    > using System.WinForms;
    > using System.Drawing;
    > using System.Drawing.Drawing2D;
    > using System.Drawing.Imaging;
    > public class h2:Form


    Um. This isn't C code. If I had to guess I'd guess C#, which isn't C;
    it's a dramatically different language with some similar bits of
    syntax. You need a C# group or an MS group with C# expertise.

    --
    Hewlett-Packard Limited Cain Road, Bracknell, registered no:
    registered office: Berks RG12 1HN 690597 England
    Chris Dollin, Jun 20, 2007
    #15
  16. wrote:
    > dear all
    > i try to build the digital clock but it has some problems
    > and errors plz remove those erros and help me . i am sending the code
    > plz debug it
    >
    > i shall be very thankful to u for this act of kindness
    >
    >
    > the code is as below
    >
    > #include<conio.h>
    > #include<stdio.h>
    > #include<graphics.h>


    Neither <conio.h> nor <graphics.h> is a standard C header. You should
    post to a newsgroup for whatever implementation uses those things, not
    comp.lang.c.

    > using System;
    > using System.WinForms;
    > using System.Drawing;
    > using System.Drawing.Drawing2D;
    > using System.Drawing.Imaging;


    All of the 5 lines above are syntax errors. There are no "using"
    statements in C. You should post questions about whatever language you
    are using to a newsgroup for that language. It sure is *not* C.

    Every one of the remaining lines of your code is similarly neither C nor
    topical here.

    You have only three lines which are not syntax errors, the three
    includes. If this non-C mess is actually C++, before you post to some
    other newsgroup change the only line of your post with a defined meaning
    in standard C
    > #include<stdio.h>

    to be C++:
    #include <cstdio>

    With the appropriate headers and associated libraries
    > #include<conio.h>

    and
    > #include<graphics.h>

    are legal lines of C, but since <conio.h> and <graphics.h> have no
    meaning within the defined standard C language, the lines are not more
    meaningful than
    #include <this_is_a_mystery_header>


    > public class h2:Form
    > {
    > private Image []image=new Bitmap[10];
    > private Image colon=null;
    > Timer t=new Timer();
    > Rectangle rec=new Rectangle(50,50,100,100);
    > h2()
    > {
    > for(int x=0;x<10;x++)
    > image[x]=new Bitmap(x+".gif");
    > colon=new Bitmap("colon.gif");
    > this.Size=new Size(350,50);
    > this.BorderStyle=FormBorderStyle.None;
    > this.BackgroundImage=new Bitmap("back5.gif");
    > this.StartPosition=FormStartPosition.Manual;
    > this.DesktopLocation=new Point(400,0);
    > this.ShowInTaskbar=false;
    > this.TopMost=true;
    > this.Opacity=0.50;
    > t.Interval=1000;
    > t.Tick+=new EventHandler(draw1);
    > t.Enabled=true;
    > }
    > protected override void OnPaint(PaintEventArgs a)
    > {
    > Graphics g=a.Graphics;
    > int hh=DateTime.Now.Hour;
    > int hh1=hh/10;
    > int hh2=hh%10;
    > g.DrawImage(image[hh1],0,1,40,40);
    > g.DrawImage(image[hh2],40,1,40,40);
    > g.DrawImage(colon,80,5,30,30);
    > int mm=DateTime.Now.Minute;
    > int mm1=mm/10;
    > int mm2=mm%10;
    > g.DrawImage(image[mm1],115,1,40,40);
    > g.DrawImage(image[mm2],155,1,40,40);
    > g.DrawImage(colon,195,5,30,30);
    > int ss=DateTime.Now.Second;
    > int ss1=ss/10;
    > int ss2=ss%10;
    > g.DrawImage(image[ss1],230,1,40,40);
    > g.DrawImage(image[ss2],285,1,40,40);
    > }
    > public void draw1(object ob,EventArgs a)
    > {
    > this.Invalidate();
    > }
    > public static void Main()
    > {
    > Application.Run(new h2());
    > }
    > }
    >
    >
    Martin Ambuhl, Jun 20, 2007
    #16
  17. Martin Ambuhl said:

    <snip>
    >
    > Every one of the remaining lines of your code is similarly neither C
    > nor topical here.
    >
    > You have only three lines which are not syntax errors, the three
    > includes. If this non-C mess is actually C++,


    It isn't.

    --
    Richard Heathfield
    "Usenet is a strange place" - dmr 29/7/1999
    http://www.cpax.org.uk
    email: rjh at the above domain, - www.
    Richard Heathfield, Jun 20, 2007
    #17
  18. Spoon Guest

    Chris Dollin wrote:

    > fr gdz sk dn't brvt lk tht -- ts hrd t rd.


    Dude!

    It's spelled "bbrvt" ;-)

    The strange thing is that I can read the gibberish you posted.
    Spoon, Jun 20, 2007
    #18
  19. Chris Dollin Guest

    Spoon wrote:

    > Chris Dollin wrote:
    >
    >> fr gdz sk dn't brvt lk tht -- ts hrd t rd.

    >
    > Dude!
    >
    > It's spelled "bbrvt" ;-)


    H, bthr!

    > The strange thing is that I can read the gibberish you posted.


    With any luck, the same will apply to C code I post.

    --
    Hewlett-Packard Limited Cain Road, Bracknell, registered no:
    registered office: Berks RG12 1HN 690597 England
    Chris Dollin, Jun 20, 2007
    #19
  20. CBFalconer Guest

    wrote:
    >
    > i try to build the digital clock but it has some problems and
    > errors plz remove those erros and help me . i am sending the code
    > plz debug it
    >
    > i shall be very thankful to u for this act of kindness
    >
    > the code is as below
    >
    > #include<conio.h>

    no such standard include file

    > #include<stdio.h>
    > #include<graphics.h>

    no such standard include file

    > using System;
    > using System.WinForms;
    > using System.Drawing;
    > using System.Drawing.Drawing2D;
    > using System.Drawing.Imaging;
    > public class h2:Form


    None of the above lines make any sense in standard C.

    In other words you are either on the wrong newsgroup or mightily
    confused.

    BTW, u has not posted on this newsgroup for a long time. The
    personal pronoun 'I' is normally capitalized.

    --
    <http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>
    <http://www.securityfocus.com/columnists/423>
    <http://www.aaxnet.com/editor/edit043.html>
    cbfalconer at maineline dot net



    --
    Posted via a free Usenet account from http://www.teranews.com
    CBFalconer, Jun 20, 2007
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Henning Bahr
    Replies:
    6
    Views:
    4,517
    S. Ramirez
    Jul 19, 2003
  2. Valentin Tihomirov

    Are clock and divided clock synchronous?

    Valentin Tihomirov, Oct 23, 2003, in forum: VHDL
    Replies:
    11
    Views:
    3,277
    louis lin
    Oct 28, 2003
  3. Replies:
    4
    Views:
    1,247
    Eric Smith
    Dec 2, 2007
  4. evolgrin

    Digital Clock Help

    evolgrin, Jun 2, 2009, in forum: VHDL
    Replies:
    1
    Views:
    585
    jeppe
    Jun 2, 2009
  5. tarek
    Replies:
    0
    Views:
    1,853
    tarek
    Dec 5, 2009
Loading...

Share This Page