Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- using std::cout;
- using std::cin;
- using std::endl;
- void main()
- {
- int x = 4, y = 4;
- char key = 0;
- while (key != 27)
- {
- for (int i = 0; i < 10; i++)
- {
- for (int j = 0; j < 10; j++)
- {
- if ((i >= 0 && i < 10) && (j == 0 || j == 9)) cout << (char)179;
- else if ((i == 0 || i == 10) && (j >= 0 && j < 10)) cout << (char)205;
- if ((i == y || i == y + 1) && (j == x || j == x + 1)) cout << "* ";
- else cout << " ";
- /*if (((i <= 2 || i >= 7) || (j <= 2 || j >= 7)) && !((i == 4 || i == 6) && (j >= 0 && j <= 2)) && !((i == 3 || i == 5) && (j >= 7 && j <= 9))) cout << "- ";
- else if ((i == 4 || i == 6) && (j >= 0 && j <= 2)) cout << "\\ ";
- else if ((i == 3 || i == 5) && (j >= 7 && j <= 9)) cout << "/ ";
- else cout << "* ";*/
- }
- cout << endl;
- }
- switch (key)
- {
- case 87: // W
- y -= 1;
- break;
- case 119: // W
- y -= 1;
- break;
- case 83: // W
- y += 1;
- break;
- case 115: // W
- y += 1;
- break;
- case 65:
- x -= 1;
- break;
- case 97:
- x -= 1;
- break;
- case 68:
- x += 1;
- break;
- case 100:
- x += 1;
- break;
- }
- key = getch();
- system("cls");
- }while (key != 27);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement