By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,991 Members | 1,911 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,991 IT Pros & Developers. It's quick & easy.

SOURCE CODE FOR DIGITAL CLOCK IN C LANGUAGE

P: n/a
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 HOMPLZ DO REPLY ME PLZ

Jun 14 '07 #1
Share this Question
Share on Google+
24 Replies


P: n/a
mo**************@hotmail.com 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 HOMPLZ DO REPLY ME PLZ
DON'T SHOUT!

Unless you are using a teletype.

--
Ian Collins.
Jun 14 '07 #2

P: n/a
On Thu, 14 Jun 2007 02:29:43 -0700, in comp.lang.c ,
mo**************@hotmail.com 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 HOMPLZ 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
Jun 14 '07 #3

P: n/a

<mo**************@hotmail.comwrote in message
news:11*********************@i13g2000prf.googlegro ups.com...
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 HOMPLZ 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");
}
Jun 14 '07 #4

P: n/a
Serve Laurijssen wrote:
>
<mo**************@hotmail.comwrote in message
news:11*********************@i13g2000prf.googlegro ups.com...
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 HOMPLZ 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:Th*************@gmail.com>

Jun 14 '07 #5

P: n/a
On Jun 14, 12:06 pm, Kenneth Brody <kenbr...@spamcop.netwrote:
Serve Laurijssen wrote:
<mohsinalishah...@hotmail.comwrote in message
news:11*********************@i13g2000prf.googlegro ups.com...
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 HOMPLZ 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

Jun 14 '07 #6

P: n/a
On Jun 14, 12:50 pm, Lew Pitcher <lpitc...@teksavvy.comwrote:
On Jun 14, 12:06 pm, Kenneth Brody <kenbr...@spamcop.netwrote:
Serve Laurijssen wrote:
<mohsinalishah...@hotmail.comwrote in message
>news:11*********************@i13g2000prf.googlegr oups.com...
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 HOMPLZ 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

Jun 14 '07 #7

P: n/a
mo**************@hotmail.com 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 HOMPLZ 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:sp******@clevermonkey.org>

Direct replies will be blacklisted. Replace "spamtrap" with my name to
contact me directly.
Jun 14 '07 #8

P: n/a
Serve Laurijssen wrote:
<mo**************@hotmail.comwrote 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 HOMPLZ 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. :-)

--
<http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfocus.com/columnists/423>
<http://www.aaxnet.com/editor/edit043.html>
<http://kadaitcha.cx/vista/dogsbreakfast/index.html>
cbfalconer at maineline dot net
--
Posted via a free Usenet account from http://www.teranews.com

Jun 14 '07 #9

P: n/a
mo**************@hotmail.com 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 HOMPLZ DO REPLY ME PLZ
/bin/date
Jun 14 '07 #10

P: n/a
In article <5d**************@mid.individual.net>, Ian Collins
<ia******@hotmail.comwrites
>mo**************@hotmail.com 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 HOMPLZ DO REPLY ME PLZ
DON'T SHOUT!

Unless you are using a teletype.
Is that a sort of teletubby?

--
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills Staffs England /\/\/\/\/
/\/\/ ch***@phaedsys.org www.phaedsys.org \/\/\
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/

Jun 14 '07 #11

P: n/a

"CBFalconer" <cb********@yahoo.comwrote in message
news:46***************@yahoo.com...
Serve Laurijssen wrote:
><mo**************@hotmail.comwrote 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 HOMPLZ 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
Jun 15 '07 #12

P: n/a
On Jun 14, 5:29 am, mohsinalishah...@hotmail.com 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 HOMPLZ 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

Jun 15 '07 #13

P: n/a
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 '07 #14

P: n/a
mo**************@hotmail.com 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.
Jun 20 '07 #15

P: n/a
mo**************@hotmail.com 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

Jun 20 '07 #16

P: n/a
mo**************@hotmail.com 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.hnor <graphics.his 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.hand <graphics.hhave 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());
}
}

Jun 20 '07 #17

P: n/a
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.
Jun 20 '07 #18

P: n/a
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.
Jun 20 '07 #19

P: n/a
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

Jun 20 '07 #20

P: n/a
mo**************@hotmail.com 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

Jun 20 '07 #21

P: n/a
"Spoon" <root@localhostwrote in message
news:46***********************@news.free.fr...
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.
Did anyone else try to ROT-13 it?
Jun 21 '07 #22

P: n/a
BWIGLEY said:
"Spoon" <root@localhostwrote in message
news:46***********************@news.free.fr...
>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.

Did anyone else try to ROT-13 it?
/me holds his hand up.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
Jun 21 '07 #23

P: n/a
"Richard Heathfield" <rj*@see.sig.invalidschrieb im Newsbeitrag
news:lO******************************@bt.com...
BWIGLEY said:
>"Spoon" <root@localhostwrote in message
news:46***********************@news.free.fr...
>>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.

Did anyone else try to ROT-13 it?

/me holds his hand up.
did it do you any good?

Bye, Jojo
Jun 21 '07 #24

P: n/a
Richard Heathfield wrote:
BWIGLEY said:
>"Spoon" <root@localhostwrote in message
news:46***********************@news.free.fr...
>>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.

Did anyone else try to ROT-13 it?

/me holds his hand up.
Richard! I don't know whether to castigate you for missing the obvious,
be pleased to have caught you out, or to be self-congratulatory on the
impenetrability of my gibberish.

--
Chris "#3 not looking so clever post-hoc" Dollin

Hewlett-Packard Limited Cain Road, Bracknell, registered no:
registered office: Berks RG12 1HN 690597 England

Jun 21 '07 #25

This discussion thread is closed

Replies have been disabled for this discussion.