网络编程 | 站长之家 | 网页制作 | 图形图象 | 操作系统 | 冲浪宝典 | 软件教学 | 网络办公 | 邮件系统 | 网络安全 | 认证考试 | 系统进程
Firefox | IE | Maxthon | 迅雷 | 电驴 | BitComet | FlashGet | QQ | QQ空间 | Vista | 输入法 | Ghost | Word | Excel | wps | Powerpoint
asp | .net | php | jsp | Sql | c# | Ajax | xml | Dreamweaver | FrontPages | Javascript | css | photoshop | fireworks | Flash | Cad | Discuz!
当前位置 > 网站建设学院 > 网络编程 > C/C++
Tag:注入,存储过程,分页,安全,优化,xmlhttp,fso,jmail,application,session,防盗链,stream,无组件,组件,md5,乱码,缓存,加密,验证码,算法,cookies,ubb,正则表达式,水印,索引,日志,压缩,base64,url重写,上传,控件,Web.config,JDBC,函数,内存,PDF,迁移,结构,破解,编译,配置,进程,分词,IIS,Apache,Tomcat,phpmyadmin,Gzip,触发器,socket
网络编程:ASP教程,ASP.NET教程,PHP教程,JSP教程,C#教程,数据库,XML教程,Ajax,Java,Perl,Shell,VB教程,Delphi,C/C++教程,软件工程,J2EE/J2ME,移动开发
本月文章推荐
.用CB控制Windows注册表.
.C语言表达式.
.Bjarne:什么是函数对象?.
.C++习题与解析(类和对象-06).
.迷宫.
.C++运算符重载函数基础及其值返回.
.剖析Windows任务管理器开发原理与.
.More Effective C++:理解new和d.
.C语言初学者入门讲座 第二讲 数据.
.C语言函数的作用域规则.
.Visual FoxPro 9中新的数据处理方.
.QQ用户小心了! C语言实现QQ密码大.
.数据结构C语言实现系列——二叉树.
.Order by 的数值型灵活使用.
.C语言常用的三种排序方法总结与探.
.信号(signal)介绍.
.TCanvas.
.DVD解码源代码大公布.
.DOS下的3D按钮.
.奇技淫巧C++之返回值重载.

修正后的“模拟windows 日期/时间 的C程序

发表日期:2008-3-8


上次传的那个我传完之后才发现是我先前没做好的版本,漏洞百出。 这次上传的的是我修正后的版本。 主要修正了万年历的诸多错误! 还有连按按键屏幕出错的问题。 还有时针的错误。 反正是错误百出!!嘻嘻嘻,不好意思:) 本人在此声明:此程序为本人原创,由于是本人的课设作业,如有北工大的同学,请勿抄袭,发表此程序完全为了交流经验,互相学习、探讨之用。如有问题可以给我发邮件,谢谢。
非常希望大家给我能提出宝贵意见。 #include<graphics.h>
#include<stdio.h>
#include<math.h>
#include<dos.h>
#define PI 3.1415926
#define UP 0x4800
#define DOWN 0x5000
#define ESC 0x11b
#define TAB 0xf09
clock();
date(int,int);
int digitsec(double s)/*digital clock second*/
{int i;
 for(i=0;i<=59;i++) if(s==i) return i;
 }
int digithour(double h)/*digital clock hour*/
{int i;
 for(i=0;i<=23;i++) if(h==i) return i;
 }
int digitmin(double m)/*digital clock minute*/
{int i;
 for(i=0;i<=59;i++) if(m==i) return i;
 }
digitclock(int x,int y,int clock)/*整个digital clock*/
{char buffer1[10];
 setfillstyle(0,2);
 bar(x,y,x+15,328);
 if(clock==60) clock=0;
 sprintf(buffer1,"%d",clock);
 outtextxy(x,y,buffer1);
 }
cursor(int count)    /*画一个光标函数*/
{switch(count)
 {case 1:line(156,108,156,118);break;
  case 2:line(280,108,280,118);break;
  case 3:line(424,315,424,325);break;
  case 4:line(465,315,465,325);break;
  case 5:line(505,315,505,325);break;
  }
 }
clear(int count)    /*清除光标函数*/
{switch(count)
 {case 2:line(156,108,156,118);break;
  case 3:line(280,108,280,118);break;
  case 4:line(424,315,424,325);break;
  case 5:line(465,315,465,325);break;
  case 1:line(505,315,505,325);break;
  }
 }
int key(int,int);
int dateupchange(int);
int datedownchange(int);
int timeupchange(int);
int timedownchange(int);
double h,m,s;
double x,x1,x2,y,y1,y2;
char buffer[80];
strUCt time t[1];
struct date da[1];
main()
{int driver, mode=0,i,j;
 int year,mon;
 char *month[]={"SUN","MON","TUE","WEN","THU","FRI","SAT"};
 driver=DETECT;
 initgraph(&driver, &mode, "");
 setlinestyle(0,0,3);
 setbkcolor(0);

 setcolor(7);
 line(82,430,558,430);
 line(70,62,70,418);
 line(82,50,558,50);
 line(570,62,570,418);
 line(70,62,570,62);
 line(76,56,297,56);
 line(340,56,564,56);  /*画主体框架*/
 setlinestyle(0,0,3);
 arc(82,62,90,180,12);
 setlinestyle(0,0,3);
 arc(558,62,0,90,12);
 setlinestyle(0,0,3);
 arc(82,418,180,279,12);
 setlinestyle(0,0,3);
 arc(558,418,270,360,12);   /*画边角*/
 setcolor(15);
 outtextxy(300,53,"CLOCK"); /*总标题*/
 setcolor(7);
 rectangle(80,72,332,360);  /*月历的框架*/
 rectangle(342,72,560,360); /*时钟的框架*/
 for(j=78;j<=84;j+=6)
 line(80,j,332,j);
 setwritemode(1);
 line(190,78,225,78);
 setwritemode(0);
 setcolor(15);
 outtextxy(193,75,"DATE");
 setcolor(7);
 rectangle(90,106,160,120);
 outtextxy(163,110,"(M)");  /*打印月份标题*/
 rectangle(190,106,290,120);
 outtextxy(293,110,"(Y)");  /*打印年标题*/
 for(i=0,j=90;i<7;i++,j+=35)
 outtextxy(j,145,month[i]);/*打印周一至周日*/
 rectangle(88,140,323,330);
 line(88,158,323,158);/*月份的框架*/
 for(j=78;j<=84;j+=6)
 line(342,j,560,j);
 setwritemode(1);
 line(431,78,465,78);
 setwritemode(0);
 setcolor(15);
 outtextxy(433,75,"TIME");/*时钟的标题*/
 setcolor(7);
 line(392,310,510,310);
 line(392,330,510,330);
 arc(392,320,90,270,10);
 arc(510,320,270,90,10);
 for(i=431;i<=470;i+=39)
 for(j=317;j<=324;j+=7){
  setlinestyle(0,0,3);
  circle(i,j,1);
  }                  /*DIG99vAL CLOCK*/
 setcolor(15);
 line(156,108,156,118);     /*在运行起始先画一个光标*/
 for(i=0,m=0,h=0;i<=11;i++,h++){                                   /*hour points*/
    x=100*sin((h*60+m)/360*PI)+451;
    y=200-100*cos((h*60+m)/360*PI);
    setlinestyle(0,0,3);
    circle(x,y,1);
    }
 for(i=0,m=0;i<=59;m++,i++){                                       /*minute points*/

       x=100*sin(m/30*PI)+451;
       y=200-100*cos(m/30*PI);
       setlinestyle(0,0,1);
       circle(x,y,1);
       }
 setcolor(9);
 outtextxy(83,380,"COLLEGE OF COMPUTER SCIENCE BEIJING UNIVERS99vY OF TECHNOLOGY");
 outtextxy(400,400,"DESIGNED BY flowers");
 outtextxy(500,410,"2003.6");
 setcolor(15);
 outtextxy(81,380,"COLLEGE OF COMPUTER SCIENCE BEIJING UNIVERS99vY OF TECHNOLOGY");
 outtextxy(398,400,"DESIGNED BY flowers");
 outtextxy(498,410,"2003.6");
 outtextxy(81,410,"Control:TAB,UP,DOWN,ESC");
 getdate(da);
 mon=da[0].da_mon;
 year=da[0].da_year;
 date(year,mon);
 clock();
 closegraph();
 return 0;
 }
clock(){
 int k=0,count;
 setcolor(15);
 gettime(t);
 h=t[0].ti_hour;
 m=t[0].ti_min;
 x=50*sin((h*60+m)/360*PI)+451;
 y=200-50*cos((h*60+m)/360*PI);
 line(451,200,x,y);
 x1=80*sin(m/30*PI)+451;
 y1=200-80*cos(m/30*PI);
 line(451,200,x1,y1);
 digitclock(408,318,digithour(h));
 digitclock(446,318,digitmin(m));
 setwritemode(1);
 for(count=2;k!=ESC;){                            /*second hand*/
   setcolor(12);
   soun
上一篇:虚拟文件系统 人气:802
下一篇:学习C++的最大难度 人气:421
浏览全部C/C++的内容 Dreamweaver插件下载 网页广告代码 祝你圣诞节快乐 2009年新年快乐