Simple Game [C++]

#include <iostream>
#include <Windows.h>
#include <conio.h>
using namespace std;
void gotoxy(int,int);
void ChangeCursorStatus(bool Visible);
void textcolor(int colorNo);
void Loading(int i, int d);
void raygun(int,int,int);

int main()
{
    int x(39), y(12);
    ChangeCursorStatus(false);
    gotoxy(x,y);
    textcolor(14);
    cout << "X";
    int keychar;
    do{
        keychar=getch();
        switch(keychar)
        {
            case 77:
                if(x<=60)
                {
                    gotoxy(x,y);
                    cout << " ";
                    gotoxy(++x,y);
                    cout << "X";
                }
                break;
            case 75:
                if(x>=5)
                {
                    gotoxy(x,y);
                    cout << " ";
                    gotoxy(--x,y);
                    cout << "X";
                }
                break;
            case 72:
                if(y>=3)
                {
                    gotoxy(x,y);
                    cout << " ";
                    gotoxy(x,--y);
                    cout << "X";
                }
                break;
            case 80:
                if(y<=20)
                {
                    gotoxy(x,y);
                    cout << " ";
                    gotoxy(x,++y);
                    cout << "X";
                }
                break;
            case 32:
                raygun(x,y,30);
                break;
        }
    }while(1);
   
   
   
    system("pause>0");
    return 0;
}


void raygun(int a, int b, int d)
{
    int c;
    for(c=b-2;c>0;c--)
    {
        Sleep(d);
        gotoxy(a,c+1); cout<<" ";
        gotoxy(a,c); cout<<"|";
    }
        gotoxy(a,c+1); cout<<" ";
}

void Loading(int i, int d)
{
    cout << "Loading ";
    for(int e=0;e<i;e++)
    {
        Sleep(d); cout<<".";
    }
}


void gotoxy(int x, int y)
{
    HANDLE hConsoleOutput;
    COORD dwCursorPosition;
    cout.flush();
    dwCursorPosition.X = x;
    dwCursorPosition.Y = y;
    hConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleCursorPosition(hConsoleOutput,dwCursorPosition);
}

void textcolor(int colorNo)
{
    HANDLE  hConsole;
    hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleTextAttribute(hConsole,colorNo);
}

void ChangeCursorStatus(bool Visible)
{

    CONSOLE_CURSOR_INFO *c= new CONSOLE_CURSOR_INFO;
    HANDLE h=GetStdHandle(STD_OUTPUT_HANDLE);
    if (Visible)
    {
        c->bVisible=TRUE;
        c->dwSize=0;
    }
    else
    {
        c->bVisible=FALSE;
        c->dwSize=1;
    }
    SetConsoleCursorInfo(h,c);
}