C++简易小球弹跳怎么设置左右和上下边框呢?

#include <iostream>
#include <windows.h>
#include <cstdlib.h>
using namespace std;
int main(){

   int i,j,x=0,y=6;
   int velocity_x=1,velocity_y=1
   int left=0;
   int right=20;
   int top=0;
   int bottom=15;

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

        system("cls");//清屏
     for(i=0;i<x;i++)
         cout<<" | "<<"                 "<<" | "<<endl;
     for(j=0;j<y;j++)
         cout<<" ";
     cout<<"o"<<endl;
     Sleep(50);
     if(x==top||x==bottom)
        velocity_x=-velocity_x;
     if(y==left||y==right)
        velocity_y=-velocity_x;
     }
   return 0;
 }

 怎么改动可以设置边框呢?
#include <iostream>
#include <windows.h>
using namespace std;
int main() {

    int i, j, x = 0, y = 6;
    int velocity_x = 1, velocity_y = 1;
    int left = 0;
    int right = 20;
    int top = 20;
    int bottom = 0;

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

        system("cls");//清屏
        for (i = 0; i < x; i++)
            cout << " | " << "                 " << " | " << endl;
        for (j = 0; j < y; j++)
            cout << " ";
        cout << "o" << endl;
        Sleep(50);
        if (x >= top || x <= bottom)
            velocity_x = -velocity_x;
        if (y <= left || y >= right)
            velocity_y = -velocity_y;
    }
    return 0;
}


int left=0;
int right=20;
int top=0;
int bottom=15;
这就是啊,左右上下的坐标