资源简介
C语言编写万年历,图片界面美观大方,人性化。可作为C语言课程设计

代码片段和文件信息
#include“graphics.h“
#include“math.h“
#include“dos.h“
#define PI 3.1415926
#define X(abc) x=a*cos(b*c*PI/180-PI/2)+320
#define Y(abc) y=a*sin(b*c*PI/180-PI/2)+220
#define d(abc) X(abc);Y(abc);line(320220xy)
#define R sqrt(2)*r0/2
int ixysmhyemodaxsxmxhysymyh;/*定义全局变量*/
float p;
struct time t;
struct date d;
/*****************************************************
1、void main() 主函数
*****************************************************/
main()
{
int x0=320y0=220r0=140graphdrivergraphmode;
void init_inface(); /*函数声明*/
void showt();
void sounds();
graphdriver=DETECT;/*初始化图形系统*/
initgraph(&graphdriver&graphmode“d:\\tc“);
init_inface(x0y0r0);
showt();
sounds();
getch();
closegraph();
}
/*****************************************************
2、init_inface()画时钟界面函数
*****************************************************/
void init_inface(int x0int y0int r0)/*划时钟界面函数*/
{
int ixy;
char a[10];
float alphaa0=90;
setbkcolor(11);/*设置背景颜色*/
cleardevice();
setcolor(RED);/*画钟表的圆盘*/
arc(x0y0-R0180R);
arc(x0y0+R180360R);
arc(x0-Ry090270R);
arc(x0+Ry027090R);
circle(x0y0r0);
circle(x0y05);
setfillstyle(SOLID_FILLYELLOW);
floodfill(x0y0-1.1*r0RED);
setfillstyle(SOLID_FILLYELLOW);
floodfill(x0y0+1.1*r0RED);
setfillstyle(SOLID_FILLYELLOW);
floodfill(x0-1.1*r0y0RED);
setfillstyle(SOLID_FILLYELLOW);
floodfill(x0+1.1*r0y0RED);
setfillstyle(SOLID_FILLWHITE);
floodfill(320-50200RED);
setcolor(GREEN);/*在指定坐标上输出字符串*/
settextstyle(002);
outtextxy(30580“12“) ;
outtextxy(315350“6“);
outtextxy(180210“9“);
outtextxy(450210“3“);
outtextxy(380100“1“);
outtextxy(225100“11“);
outtextxy(430140“2“);
outtextxy(430280“4“);
outtextxy(380335“5“);
outtextxy(250335“7“);
outtextxy(180150“10“);
outtextxy(195280“8“);
for(i=60;i>=1;i--)/*画时钟圆盘上小圆形刻度*/
{
alpha=(a0+6*(60-i))*PI/180;
x=x0+cos(alpha)*120;
y=y0-sin(alpha)*120;
setcolor(BLUE);
if(i%5==0)
circle(xy4);
else circle(xy2);
setfillstyle(SOLID_FILLBLUE);
floodfill(xyBLUE);
}
setcolor(10);/*画眼睛及嘴巴*/
setlinestyle(003);
ellipse(27018003602530);
setlinestyle(003);
ellipse(270180180360255);
setlinestyle(003);
ellipse(2701801853551530);
setcolor(LIGHTRED);
setlinestyle(003);
ellipse(3202501803605020);
setlinestyle(003);
ellipse(3202502003403050);
setcolor(10);
setlinestyle(003);
ellipse(37018003602530);
setlinestyle(003);
ellipse(370180180360255);
setlinestyle(003);
ellipse(3701801853551530);
setcolor(LIGHTRED);
}
/*****************************************************
3、showt(void) 画表针
*****************************************************/
void showt(void)/*画表针*/
{
setwritemode(1);/*设置画线的输出模式*/
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 4888 2008-02-26 17:45 clock.c
----------- --------- ---------- ----- ----
4888 1
- 上一篇:运动会成绩管理系统实验报告 C++编写
- 下一篇:MFC实现PopStar小游戏
相关资源
- C++中头文件与源文件的作用详解
- C语言代码高亮html输出工具
- 猜数字游戏 c语言代码
- C语言课程设计
- 数字电位器C语言程序
- CCS FFT c语言算法
- 使用C语言编写的病房管理系统
- 通信过程中的RS编译码程序(c语言)
- 计算机二级C语言上机填空,改错,编
- 用回溯法解决八皇后问题C语言实现
- 简易教务管理系统c语言开发文档
- 操作系统课设 读写者问题 c语言实现
- 小波变换算法 c语言版
- C流程图生成器,用C语言代码 生成C语
- 3des加密算法C语言实现
- 简单的C语言点对点聊天程序
- 单片机c语言源程序(51定时器 八个按
- 个人日常财务管理系统(C语言)
- c语言电子商务系统
- 小甲鱼C语言课件 源代码
- 将图片转换为C语言数组的程序
- C语言实现的一个内存泄漏检测程序
- DES加密算法C语言实现
- LINUX下命令行界面的C语言细胞游戏
- 用单片机控制蜂鸣器播放旋律程序(
- 学校超市选址问题(数据结构C语言版
- 电子时钟 有C语言程序,PROTEUS仿真图
- 尚观培训linux许巍老师关于c语言的课
- 算符优先语法分析器(C语言编写)
- 基于C语言的密码锁程序
评论
共有 条评论