Untitled

mail@pastecode.io avatar
unknown
plain_text
8 months ago
462 B
1
Indexable
Never
#include <iostream>
using namespace std;
int main()
{
	int x = 0;
	int y = 0;
	char a = 0;
    while (a != 'x')
    {
		cin >> a;
	    switch (a)
	    {
	    case 'a':
			x -= 1;
			break;
		case 'd':
			x += 1;
			break;
		case 's':
			y -= 1;
			break;
	    case 'w':
		    y += 1;
			break;
		case 'x':
			cout << "----------------\n" << "End!\n" << "----------------";
			return 0;
		}
		cout << x << ' ' << y << "\n";
    }
}