Untitled
unknown
plain_text
2 years ago
475 B
5
Indexable
#include <iostream>
using namespace std;
int main()
{
setlocale(LC_ALL, "Russian");
char a;
int x = 0;
int y = 0;
while (cin >> a) {
if (a == 'X' || a == 'x')
break;
switch (a)
{
case 'W':
case 'w':
y += 1;
break;
case 'A':
case 'a':
x -= 1;
break;
case 'S':
case 's':
y -= 1;
break;
case 'D':
case 'd':
x += 1;
break;
}
}
cout <<"Координаты: "<< x << ' ' << y;
}
Editor is loading...