一个 300个小球 弹动 屏保~~
easyx吧
全部回复
仅看楼主
level 8
Sail丶Man 楼主
~~~~~~~~按ESC可退出程序~~~~~~~~
# include <graphics.h>
# include <conio.h>
# include <time.h>
# include <math.h>
int Quit(void);
int huadian(float * ,float * , int * , int *);
int main(void)
{
float box[2][300];
int a[300]={0};
int b[300]={0};
initgraph(640,480);
srand((unsigned)time(NULL));
for(int i=0; i<300; i++)
box[0][i] = 10 + ((rand() % 31 + 1) - 1) * 20 ;
for(int j=0; j<300; j++)
box[1][j] = 10 + ((rand() % 23 + 1) - 1) * 20 ;
while(true)
{for(int l=0; l<300 ; l++)
huadian(&box[0][l], &box[1][l], &a[l], &b[l]);
Quit();}return 0;}
int Quit(void)
{if(kbhit())
if(27 == getch())
{HWND wnd = GetHWnd();
if(MessageBox(wnd, "你确定要退出吗?","提示", MB_YESNO) == IDYES)
exit(0);}return 0;}
int huadian(float * x, float * y, int * a,int * b)
{setfillcolor(BLACK);
solidcircle(*x,*y,10);
*x = *x + 3 * pow((-1),(*a)) ;
*y = *y + 3 * pow((-1),(*b)) ;
if(*y >= 470) {*b = 1;}
if(*x >= 630) {*a = 1;}
if(*y <= 10) {*b = 0;}
if(*x <= 10) {*a = 0;}
setfillcolor(GREEN);
solidcircle(*x,*y,10);
return 0;}
2013年08月22日 04点08分 1
吧务
level 11
好玩,还有点立体感。
2013年08月28日 06点08分 2
呵呵 , 前几天, 在努力学习数据结构 ,没有网络~。
2013年08月29日 11点08分
回复 Sail丶Man :这里“solidcircle(*x,*y,10);”是什么意思?楼主为什么我的运行不了呢
2013年08月29日 13点08分
回复 醉听水声 :就是空心圆 你没装easyx吧?
2013年08月29日 15点08分
回复 醉听水声 :你编译后有什么错误吗?
2013年09月01日 09点09分
level 8
赞个
2013年08月28日 09点08分 3
谢谢
2013年09月12日 14点09分
level 7
很好玩呢
2013年09月11日 01点09分 5
level 4
留名
2014年12月17日 02点12分 6
level 5

2014年12月19日 10点12分 7
1