C++利用graphics.h的钟表程序
来源:互联网 发布:拟南芥基因数据库 编辑:程序博客网 时间:2024/04/27 13:41
#include<graphics.h>#include<iostream>#include<cmath>#include<ctime>#define PI 3.141592653using namespace std;int gettime(){return clock()/CLOCKS_PER_SEC;}void plottime(int h,int m,int s){moveto(200,200);lineto(200+90*cos((90-s*6)*PI/180),200-90*sin((90-s*6)*PI/180));moveto(200,200);lineto(200+70*cos((90-m*6)*PI/180),200-70*sin((90-m*6)*PI/180));moveto(200,200);lineto(200+40*cos((90-h*30)*PI/180),200-40*sin((90-h*30)*PI/180));}void plotfigure(){int x,y;char str[3];circle(200,200,100);for(int i=0;i<12;i++){x=int(200+100*cos((90-i*30)*PI/180));y=int(200-100*sin((90-i*30)*PI/180));circle(x,y,3);sprintf(str,"%d",i==0?12:i);outtextxy(x,y,str);}}int main(){time_t t;int lasttime=0;int nowtime=0;tm *lotime;initgraph(640,480);plotfigure();t=time(0);lotime=localtime(&t);plottime(lotime->tm_hour,lotime->tm_min,lotime->tm_sec);while(1){nowtime=gettime();if(nowtime-lasttime>0){t=time(0);lotime=localtime(&t);cleardevice();plotfigure();plottime(lotime->tm_hour,lotime->tm_min,lotime->tm_sec);lasttime=nowtime;}}getchar();closegraph();return 0;}
0 0
- C++利用graphics.h的钟表程序
- 利用c语言编辑--钟表模拟程序(表针形式)
- C语言程序简单实现贪吃蛇小游戏—不需要graphics.h头文件
- C语言写的一个钟表(很炫哦)
- graphics.h
- graphics.h
- graphics.h
- graphics.h
- 小议C的graphics.h在VC下无法使用的解决办法
- 利用canvas绘制钟表
- DEV-C++中graphics.h的使用
- DEV-C++中graphics.h的使用
- 如何利用css3来实现网页中钟表的效果
- 钟表小程序
- Class实现钟表程序
- 一个简单的钟表程序,请帮忙改改
- 利用构造函数 创建钟表
- Graphics.h绘图
- adb remount 失败:remount failed: Permission denied
- uiwebview与js交互
- eclipse4.4安装windowbuilder
- UIWebView中Html中用JS调用OC方法及OC执行JS代码
- 强制删除文件夹
- C++利用graphics.h的钟表程序
- 关于Java String, StringBuilder, StringBuffer, Hashtable, HashMap的面试题
- 使用ant打包Android应用
- poj 3928 树状数组
- hiwif插件开发学习
- NVIDIA Jetson TK1学习与开发(三):图文详解Jetson TK1平台搭建
- MFC 基于对话框 程序,如何添加状态栏
- linux ubuntu 12.04 下cpmd安装步骤
- WTL入门( 一) ATL简介