#include <iostream>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
int main()
{
int i,j;
int x=0,y=5;
int top=0,height=10;//上下边框
int left=0,right=10;//左右边框
int vx=1,vy=1;// 速度
while(1)
{
x=x+vx;
y=y+vy;
system("cls"); //清屏函数
for(i=0;i<x;i++)
{
printf("\n");
}
for(j=0;j<y;j++)
{
printf(" ");
}
printf("O");
printf("\n");
if(x==top||x==height) //边界,速度反向
{
vx=-vx;
}
if(y==left||y==right){
vy=-vy;
}
}
return 0;
}

924

被折叠的 条评论
为什么被折叠?



