C语言 弹跳小球

include <stdio.h>

include <stdlib.h>

include <windows.h>

int main()
{
int i, j;
int x=2;
int y = 5;
int velocity_x =1;
int velocity_y =1;
int left =0;
int right =80;
int top = 0;
int bottom = 10;

while(1)
{

x = x + velocity_x;
y = y + velocity_y;
system("cls");

for (i=1; i <x; i++)
{
printf("\n");
}
for (j=1; j<y; j++)
{
printf(" ");
}
printf("o\n");
if ((xtop)|| (xbottom))
velocity_x = -velocity_x;
if ((yleft)||(yright))
velocity_y = -velocity_y;
}

return 0;

}

posted @ 2021-03-06 23:36  未来全栈攻城狮  阅读(234)  评论(0)    收藏  举报