云题海 - 专业文章范例文档资料分享平台

当前位置:首页 > Turbo C 2.0绘制时钟和三角形

Turbo C 2.0绘制时钟和三角形

  • 62 次阅读
  • 3 次下载
  • 2026/4/23 8:49:05

用Torbo C 2.0编译

时钟

#include #define PI 3.1416 #include \#include \main() { int x0=320,y0=240,r0=150; void init_screen(); void sec(); init_screen(x0,y0,r0); sec(); closegraph(); }

void init_screen(int x0,int y0,int z0) { int i,x,y,graphdriver,graphmode; char s[10]; float alpha,a0=90; graphmode=VGAHI; graphdriver=VGA; initgraph(&graphdriver,&graphmode,\ cleardevice(); setbkcolor(1);setcolor(2); circle(x0,y0,z0); circle(x0,y0,z0+30); setfillstyle(SOLID_FILL,10); floodfill(x0-z0-10,y0,2); for(i=12;i>=1;i--) { alpha=(a0+30*(12-i))*PI/180; x=x0+cos(alpha)*z0-16; y=y0-sin(alpha)*z0; sprintf(s,\ setcolor(4); settextstyle(0,0,2); outtextxy(x,y,s); } for(i=60;i>=1;i--) { alpha=(a0+6*(60-i))*PI/180; x=x0+cos(alpha)*(z0-20); y=y0-sin(alpha)*(z0-20); setcolor(14); if(i%5==0)

circle(x,y,5); else circle(x,y,2); floodfill(x,y,14); } settextstyle(0,0,3); }

void sec(void) { int x,y,i,j,k,xj,yj,yk,xk,xi,yi,x0=320,y0=240,r0=150; unsigned char *shijie=\ unsigned char *quanqiu=\ struct time tim; struct date dat; float alphai,alphaj,alphak,a0=90; xi=x0; yi=y0; xj=x0; yj=y0; xk=x0; yk=y0; do { x=38; y=12; gettime(&tim); sprintf(shijie,\ setfillstyle(SOLID_FILL,3); settextstyle(2,0,6); bar(276,190,352,205); setcolor(WHITE); outtextxy(278,190,shijie); x=48; y=22; getdate(&dat); sprintf(quanqiu,\ setfillstyle(SOLID_FILL,5); bar(262,210,365,225); setcolor(WHITE); settextstyle(2,0,6); outtextxy(265,210,quanqiu); circle(x0,y0,100); x=190; y=430; setcolor(YELLOW); settextstyle(2,0,8); outtextxy(x,y,\ setlinestyle(0,0,3); k=tim.ti_hour; j=tim.ti_min; i=tim.ti_sec; alphak=(a0+30*(12-k)-j*5/60*6)*PI/180; alphaj=(a0-6*j)*PI/180;

alphai=(a0+6*(60-i))*PI/180; x=x0+cos(alphai)*(r0-25); y=y0-sin(alphai)*(r0-25); setcolor(BLACK); line(x0,y0,xi,yi); setcolor(LIGHTRED); line(x0,y0,x,y); xi=x; yi=y; alphaj=(a0-6*j)*PI/180; x=x0+cos(alphaj)*(r0-47); y=y0-sin(alphaj)*(r0-47); setcolor(BLACK); line(x0,y0,xj,yj); setcolor(LIGHTRED); line(x0,y0,x,y); xj=x; yj=y; alphak=(a0+30*(12-k)-j*5/60*6)*PI/180; x=x0+cos(alphak)*(r0-60); y=y0-sin(alphak)*(r0-60); setcolor(BLACK); line(x0,y0,xk,yk); setcolor(LIGHTRED); line(x0,y0,x,y); xk=x; yk=y; delay(100); }while(!kbhit()); }

效果:

三角形

#include main() { int driver=DETECT,mode; int s[8]={100,100,100,200,200,200,100,100}; initgraph(&driver,&mode,\ setfillstyle(7,5); fillpoly(4,s); getch(); restorecrtmode(); } 效果:

搜索更多关于: Turbo C 2.0绘制时钟和三角形 的文档
  • 收藏
  • 违规举报
  • 版权认领
下载文档10.00 元 加入VIP免费下载
推荐下载
本文作者:...

共分享92篇相关文档

文档简介:

用Torbo C 2.0编译 时钟 #include #define PI 3.1416 #include \#include \main() { int x0=320,y0=240,r0=150; void init_screen(); void sec(); init_screen(x0,y0,r0); sec(); closegraph(); } void init_screen(int x0,int y0,int z0) { int i,x,y,graphdriver,graphmode; char s[10]; float alpha,a0=90; graphmode=VGAHI; graphdriver=VGA; initgraph(&graphdriver,&graphmode,\

× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:10 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219
Copyright © 云题海 All Rights Reserved. 苏ICP备16052595号-3 网站地图 客服QQ:370150219 邮箱:370150219@qq.com