Untitled

mail@pastecode.io avatar
unknown
plain_text
8 months ago
475 B
1
Indexable
Never
#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;
}