1 Star 0 Fork 0

Tranquil / 小球(第一次编辑不是提交的)

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
README.md 623 Bytes
一键复制 编辑 原始数据 按行查看 历史
Tranquil 提交于 2018-10-24 09:30 . 第六步

#include<stdio.h> #include<stdlib.h> #include<windows.h> int main() { int i, j; int x = 0; int y = 5; int velocity_x = 1; int velocity_y = 1; int left = 0; int right = 20; int top = 0; int bottom = 10;

while (1)
{
	x = x + velocity_x;
	y = y + velocity_y;

	system("cls");
	for (i = 0; i < x; i++)
		printf("\n");
	for (j = 0; j < y; j++)
	{
		printf(" ");
	}
	printf(" O \n");
	printf("\n");
	Sleep(50);
	if ((x == top) || (x == bottom))
	{
		printf("\a");
		velocity_x = -velocity_x;
	}

	if ((y == left) || (y == right))
	{
		printf("\a");
		velocity_y = -velocity_y;
	}
}
return 0;

}

1
https://gitee.com/tranquilcgy/1_shows_still_balls.git
git@gitee.com:tranquilcgy/1_shows_still_balls.git
tranquilcgy
1_shows_still_balls
小球(第一次编辑不是提交的)
master

搜索帮助