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()
- {
- setlocale(LC_ALL, "Russian");
- char sensor = 0;
- char grid[3][3] = { '*', '*', '*',
- '*', '*', '*',
- '*', '*', '*'};
- while (sensor != 27)
- {
- for (int i = 0; i < 3; i++)
- {
- cout << "\t\t\t\t";
- for (int j = 0; j < 3; j++)
- {
- cout << grid[i][j] << " ";
- }
- cout << endl;
- }
- for (int i = 0; i < 3; i++)
- {
- for (int j = 0; j < 3; j++)
- {
- grid[i][j] = '*';
- }
- cout << endl;
- }
- sensor = getch();
- system("cls");
- switch (sensor)
- {
- case 119:
- grid[0][1] = '|';
- break;
- case 87:
- grid[0][1] = '|';
- break;
- case 97:
- grid[1][0] = '_';
- break;
- case 65:
- grid[1][0] = '_';
- break;
- case 115:
- grid[2][1] = '|';
- break;
- case 83:
- grid[2][1] = '|';
- break;
- case 100:
- grid[1][2] = '_';
- break;
- case 68:
- grid[1][2] = '_';
- break;
- case 32:
- grid[2][0] = '_';
- grid[2][1] = '_';
- grid[2][2] = '_';
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement