1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
#include <iostream>
#include <iomanip>
#include <algorithm>
using namespace std;
char myScreen[ 5 ][ 5 ]
{// 0 1 2 3 4
{ '+', '+', '+', '+', '+' },//0
{ '+', '+', '+', '+', '+' },//1
{ '+', '+', 'O', '+', '+' },//2
{ '+', '+', '+', '+', '+' },//3
{ '+', '+', '+', '+', '+' } //4
};
int location[ 2 ] { 2 };
int moveScreen( char input )
{
if ( input == 'W' )
{
//need help here
}
else if ( input == 'A' )
{
//and here
}
else if ( input == 'S' )
{
//and here
}
else if ( input == 'D' )
{
//and here :)
}
}
int drawScreen( int arraySize )
{
cout << ".-----------.\n| ";
for ( int i = 0; i < arraySize; ++i )
{
for ( int j = 0; j < arraySize; ++j )
{
cout << myScreen[ i ][ j ] << " ";
}
if ( i < 4 )
cout << "|\n| ";
else
cout << "|\n";
}
cout << "'-----------'\n\t W\n\tASD\nMove: ";
}
int main()
{
const int arraySize = 5;
char input = 'W';
while ( input == 'W' || input == 'A' || input == 'S' || input == 'D' )
{
moveScreen( input );
drawScreen( arraySize );
cin >> input;
input = toupper(input);
}
}
|