#include<time.h> //包含随机数,时间函数
int main()
{
srand(time(0));//随机种子函数
for(int i =0;i<10;i++)
{
ball.x = 50+rand()%width;
ball.y = 30+rand()%height;
ball.vx = rand()%3;
ball.vy = rand()%5;
ball.radius = 10+rand()%10;
}
unsigned int R_color,G_color,B_color;
[C] 纯文本查看 复制代码 ball[i].R_color = randx(10,255);
ball[i].G_color = randx(10,255);
ball[i].B_color = randx(10,255);
setfillcolor(EGERGB(ball[i].R_color, ball[i].G_color, ball[i].B_color)); |