資源簡(jiǎn)介
C語言編寫萬年歷,圖片界面美觀大方,人性化。可作為C語言課程設(shè)計(jì)

代碼片段和文件信息
#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()?主函數(shù)
*****************************************************/
main()?
{?
int?x0=320y0=220r0=140graphdrivergraphmode;?
void?init_inface();?/*函數(shù)聲明*/
void?showt();?
void?sounds();
graphdriver=DETECT;/*初始化圖形系統(tǒng)*/
????initgraph(&graphdriver&graphmode“d:\\tc“);
init_inface(x0y0r0);
showt();
sounds();
getch();?
closegraph();?
}?
/*****************************************************
2、init_inface()畫時(shí)鐘界面函數(shù)
*****************************************************/
void?init_inface(int?x0int?y0int?r0)/*劃時(shí)鐘界面函數(shù)*/?
{
? int?ixy;
? char?a[10];
? float?alphaa0=90;?
? setbkcolor(11);/*設(shè)置背景顏色*/
? 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);/*在指定坐標(biāo)上輸出字符串*/??
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--)/*畫時(shí)鐘圓盤上小圓形刻度*/
{
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);/*設(shè)置畫線的輸出模式*/
?
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件???????4888??2008-02-26?17:45??clock.c
-----------?---------??----------?-----??----
?????????????????4888????????????????????1
評(píng)論
共有 條評(píng)論