I know that system() is relatively Windows specific but for the purposes of my class that is what we are supposed to use for the most part to get the program from just starting, running, and finishing.
Edit:
#include <iostream>
#include <iomanip>
#include <conio.h>
using namespace std;
void move(int direction,int &x,int &y)
{
if(direction=='w')
{
y-=(y!=1);
}
else if(direction=='s')
{
y+=(y!=11);
}
else if(direction=='a')
{
x-=(x!=1);
}
else if(direction=='d')
{
x+=(x!=11);
}
else {;}
return;
}
void display(int x,int y)
{
cout<<"*************\n";
for(int i=0;i<11;i++)
{
if(i+1==y)
{
cout<<"*"<<setw(x)<<"X"<<setw(13-x)<<"*\n";
}
else
{
cout<<"* *\n";
}
}
cout<<"*************\n";
}
int main()
{
int x=6;
int y=6;
int direction=27;
do
{
move(direction,x,y);
display(x,y);
direction=getch();
system("cls");
}while(direction!='q');
system("pause");
return 0;
}