ZKX's LAB

数字时钟c程序 求解答一个C语言编程: 数字时钟程序

2020-08-11知识18

c语言程序设计-数字时钟 /*开发环境:turbo c 2.0模拟时钟转动程序代码*/include\"graphics.hinclude\"math.hinclude\"dos.hdefine pi 3.1415926define X(a,b,c)x=a*cos(b*c*pi/180-pi/2)+300define Y(a,b,c)y=a*sin(b*c*pi/180-pi/2)+240define d(a,b,c)X(a,b,c);Y(a,b,c);line(300,240,x,y)void init()/*划时钟边框函数*/{int i,l,x1,x2,y1,y2;setbkcolor(1);circle(300,240,200);circle(300,240,205);circle(300,240,5);for(i=0;i;i+)/*划钟点上的短线*/{if(i%5=0)l=15;elsel=5;x1=200*sin(i*6*pi/180)+300;y1=200*cos(i*6*pi/180)+240;x2=(200-l)*sin(i*6*pi/180)+300;y2=(200-l)*cos(i*6*pi/180)+240;line(x1,y1,x2,y2);}}main(){int x,y,i,k=1;int gdriver=9,gmode=2;unsigned char h,m,s;int o,p,q;float n;struct time t[1];struct date d[1];initgraph(&gdriver,&gmode,\"c:\\\\tc\");initgraph(&gdriver,&gmode,\"c:\\\\tc\");for(i=0;i;i+){settextstyle(TRIPLEX_FONT,HORIZ_DIR,i);控制输出字符的字体,方向,大小*/cleardevice();settextjustify(1,1);在指定坐标上输出字符串*/outtextxy(300,80,\"12\");outtextxy(300,390,\"6\");outtextxy(140,230,\"9\");outtextxy(460,。C语言如何设计一个数字时钟,这个程序将使用C程序生成一个数字时钟。实现这个程序的逻辑,用0初始化小时、分钟、秒。运行一个无限循环。增加秒数并检查它是否等于60,然后。急求:毕业设计,用C语言编个简单的数字时钟程序 不想学C就用汇编啊,气死老师~单片机的程序跟硬件关系太密切,帮不了你。用C语言编一个数字电子时钟的程序 1.这是用windows api写的程序。所以要求是纯c的话就没有办法了2.其中定时用了两种方法。一种是用取消息。另一种是延时队列。这里只使用了取消息的方法。延时队列由于我机器上是vc6.0,CreateTimerQueue在本人机器上无法使用,需要新的sdk,所以没有加以验证,但取消息的方式是可行的。3.稍稍验证了下,基本满足要求。程序如下:DigitalClock.cpp:Defines the entry point for the console application.include\"stdafx.hincludeincludetypedef struct_st_time{int hour;int min;int sec;}ST_TIME;ST_TIME g_Time;The struct contain the hour,min and sec.HANDLE g_hStdout;WORD g_cxCenter,g_cyCenter;Center of the screen.HANDLE g_DoneEvent;The program could be over.BOOL g_ThreadTerminated;The Thread should be terminated.define SECOND_CIRCLE 60define MINUTE_CIRCLE 60define HOUR_CIRCLE 24void TimeIncreaseSecond(ST_TIME&st){st.sec+;if(st.sec>;=SECOND_CIRCLE){st.sec-=SECOND_CIRCLE;st.min+;if(st.min>;=MINUTE_CIRCLE){st.min-=MINUTE_CIRCLE;st.hour+;if(st.hour>;=HOUR_CIRCLE){st.hour-=HOUR_CIRCLE;}}}}void 。四位数字时钟设计 C语言程序 include<;stdio.h>;#include<;reg51.h>;sbit p20=P2^0;sbit p21=P2^1;sbit led=P2^7;main(){ unsigned int dis_1[4]={0x01,0x02,0x04,0x08};unsigned int dis_2[10]={0xc0,0xf9。

#c语言#time函数#include#时钟同步

随机阅读

qrcode
访问手机版