小球跳跃程序
#include<cstdio>
#include<windows.h>
using namespace std;
int main()
{
int x = 1, y = 1;
int stepx = 1, stepy = 1;
int i, j;
while (1)
{
system("cls");//刷新上一个
if (x < 1 || x>10)
{
stepx = -stepx;
printf("\a");//输出音频
}
if (y < 1 || y>80)
{
stepy = -stepy;
printf("\a");//输出音频
}
x += stepx;
y += stepy;
for (i = 0; i < x; i++)
printf("\n");
for (j = 0; j < y; j++)
printf(" ");
printf("O\n");
Sleep(50);//调整帧数
}
}