| 网站首页 | 新人学院 | 两性健康 | 创业学院 | 小游戏 | QQ 专区 | 性知识 | 图片 | 下载 | 推介 | 交友 | 健康无优 | 
□  您现在的位置: 新人无忧 >> 新人学院 >> 编程技巧 >> VC >> 正文
 
 

人月团圆:用C实现的爱情宣言

来源:Internet 点击数: 更新时间:2006-1-23 18:54:58   
在中秋之际,写上一段爱情宣言程序,聊表爱意。


#include "stdio.h"
#include "graphics.h"
#include "time.h"
#include "math.h"
#define N 2
#define TIME 0.8/*微粒的的运动时间,TIME/步,每一步长为25个单位*/
void *buf[N];
struct
{
int x,y;

} lizi[]={{0,0},{75,75}};

void alter_place_lizi(int *x,int *y,int key)/*根据随机方向改变粒子的方位*/
{


switch(key)
{case 0:
case 1:
case 2:*x-=25;break;
case 4:
case 5:
case 6:*x+=25;break;
}
switch(key)
{ case 0:
case 7:
case 6:*y-=25;break;
case 2:
case 3:
case 4:*y+=25;break;
}
if(*x<0) *x=0;
if(*x>250) *x=250;
if(*y<0) *y=0;
if(*y>250) *y=250;
}

void make_graphics()/*画方框*/
{int i,j,driver=VGA,mode=VGAHI;
initgraph(&driver,&mode,"");
setbkcolor(YELLOW);
cleardevice();
setcolor(LIGHTRED);
setlinestyle(0,0,1);
for(i=0;i<=10;i++)
line(0,25*i,250,25*i);
for(i=0;i<=10;i++)
line(25*i,0,25*i,250);
}


void make_circle(int x,int y,int n)/*根据提供的离子所在方位画圆*/
{
int size;
setcolor(LIGHTRED);
setlinestyle(0,0,1);
setfillstyle(1,10);
circle(x+25/2,y+25/2,25/2);
floodfill(x+25/2,y+25/2,12);
size=imagesize(x,y,x+25,y+25);
buf[n]=(void *)malloc(size);/*保存每一个圆*/
}


void sport(int *x,int *y)/*粒子的运动*/
{
time_t starttime,endtime;
int seed=0,i,j;
int key;
char s[300];
int t=1;
srand(seed);


/*保存现场图形*/
for(i=0;i getimage(x[i],y[i],x[i]+25,y[i]+25,buf[i]);
cleardevice();/*清除*/
setbkcolor(BLUE);
cleardevice();
setviewport(50, 50, 590, 430, 1); /*定义一个图形窗口*/
setfillstyle(1, 2); /*绿色以实填充*/
setcolor(YELLOW);
rectangle(0, 0,590, 230);
floodfill(50, 50, 14);
setcolor(12);
settextstyle(1, 0, 8); /*三重笔划字体, 水平放大8倍*/
outtextxy(20, 20, "I miss you");
setcolor(11);
settextstyle(1, 0, 4); /*三重笔划字体, 水平放大4倍*/
outtextxy(100, 100, "where are you");
time(&starttime);
time(&endtime);
for(;difftime(endtime,starttime)<=2.0;time(&endtime));
setbkcolor(YELLOW);
cleardevice();
setcolor(LIGHTRED);
setlinestyle(0,0,1);
while(t)
{
if(fabs(x[0]-x[1])==25&&fabs(y[0]-y[1])==25)
{for(i=0;i {key=rand()%8;
alter_place_lizi(&x[i],&y[i],key);
}
}

else if(fabs(x[0]-x[1])==25||fabs(y[0]-y[1])==25)
{key=rand()%8;
for(i=0;i alter_place_lizi(&x[i],&y[i],key);t++;
}
else
{for(i=0;i {key=rand()%8;
alter_place_lizi(&x[i],&y[i],key);
}
}

for(i=0;i putimage(x[i],y[i],buf[i],COPY_PUT);

/*界面维持0.5秒钟*/
time(&starttime);
time(&endtime);
for(;difftime(endtime,starttime)<=TIME;time(&endtime));


for(i=0;i getimage(x[i],y[i],x[i]+25,y[i]+25,buf[i]);
cleardevice();
switch(t)
{case 1:setcolor(t);
settextstyle(1, 0, 2); /*三重笔划字体, 水平放大4倍*/
outtextxy(t, t, "I am tired to look after you"); delay(1e10);
break;

case 2:setcolor(t);
settextstyle(1, 0, 2); /*三重笔划字体, 水平放大4倍*/
outtextxy(t, t, "could you wait for me please?");delay(1e10);
break;
case 3:setcolor(t);
settextstyle(1, 0, 2); /*三重笔划字体, 水平放大4倍*/
outtextxy(t, t, "I can not catch up w

[1] [2] 下一页

相关文章: 没有相关网络学院
 □ 学院热点更新 
·让我们远离病毒八项基本原则
·教你彻底防杀木马病毒(强列
·十大流氓软件完全卸载全攻略
·让ADSL永不断线--操作实战演
·有关网络的基础知识(入门手
·上网一千问(新人上网必看)
·[注意]电脑故障的排除原则、
·电脑故障排除的一般分析方法

Windows 2003服务器安

QQ图标全攻略(图)

【新手上网必看】什么

实用技巧 彻底而又简单
设为首页 - 友情连接 - 问题反馈 - 免责声明 - 广告服务 - 收藏本站 - 网站地图
www.jy361.com[新人无忧] 版权所有 Copyright©2004-2007
资源来源网络,版权规作者所有。新人学院为您提供学习的平台,谢谢对我们的支持。