教程中国
PHOTOSHOP CS9.0中文版 MAYA 8.5 FOR WINDOWS Corel Painter v9.0 Flash MX2004 中文版 Illustrator cs2 中文版
VC++6.0含sp6 中英文版 VB6.0 +sp6 简体中文版 Borland Delphi 7汉化版 MSDN for vb6.0中文版 Visual Studio 2005简体
教程中国下属 文件存储共享专家BIBIDU.COM 提供大型软件,教材,源码,电影,音乐,图书等下载 更多精品请点此进入
  您目前所在位置: 教程中国 >> C >> 编程实例 >> 一个时钟程序,可以显示当前时间,画的还不cuo RSS订阅
处理 SSI 文件时出错
一个时钟程序,可以显示当前时间,画的还不cuo
处理 SSI 文件时出错
#include<graphics.h>
#include<math.h>
#include<dos.h>
#define pi 3.1415926
#define X(a,b,c) x=a*cos(b*c*pi/180-pi/2)+300;
#define Y(a,b,c) y=a*sin(b*c*pi/180-pi/2)+240;
#define 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<60;i++)
 {if(i%5==0) l=15;
 else l=5;
 x1=200*cos(i*6*pi/180)+300;
  y1=200*sin(i*6*pi/180)+240;
   x2=(200-l)*cos(i*6*pi/180)+300;
  y2=(200-l)*sin(i*6*pi/180)+240;
  line(x1,y1,x2,y2);
  }
  }
  main()
  {
   int x,y;
   int gd=VGA,gm=2;
   unsigned char h,m,s;
   struct time t[1];
   initgraph(&gd,&gm,"d:\\tc");
   init();
   setwritemode(1);
   gettime(t);
   h=t[0].ti_hour;
   m=t[0].ti_min;
   s=t[0].ti_sec;
   setcolor(7);
   d(150,h,30);
   setcolor(14);
   d(170,m,6);
   setcolor(4);
   d(190,s,6);
   while(!kbhit())
   {while(t[0].ti_sec==s)
   gettime(t);
   sound(400);
   delay(70);
   sound(200);
   delay(30);
   nosound();
   setcolor(4);
   d(190,s,6);
   s=t[0].ti_sec;
   d(190,s,6);
   if (t[0].ti_min!=m)
   {
   setcolor(14);
   d(170,m,6);
   m=t[0].ti_min;
   d(170,m,6);
   }
   if (t[0].ti_hour!=h)
   { setcolor(7);
     d(150,h,30);
     h=t[0].ti_hour;
     d(150,h,30);
     sound(1000);
     delay(240);
     nosound();
     delay(140);
     sound(2000);
     delay(240);
     nosound();
   }
   }
   getch();
   closegraph();
   }

来源:十度教育
作者:
关键字:时钟程序,可以显示当前时间,还不cuo
发表日期:2006-9-6 11:54:01

处理 SSI 文件时出错

上一篇:静态网格椭球   下一篇:自己写的一个链表综合程序


2008-9-7 2:15:35
本文的相类似文章
  • 一个时钟程序,可以显示当前时间,画的还不cuo
  • 用VB编写简单的时钟程序(有时、分、秒针转动)
  • 在学习中进步 在进步中成长 教程中国相随您的成长之路
    华腾联合科技股份有限公司版权所有
    广告联系:Rosibo@163.com