Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
729 B
0
Indexable
Never
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
	int x;
	int y;
	const int n = 20;
	const int m = 50;
	char field[n][m];
	for (int i = 1; i < n - 1; i++)
	{
		for (int j = 0; j < m; j++)
		{
			field[i][j] = '.';
			if (j == 0 || j == m - 1) field[i][j] = '#';
		}
	}
	for (int i = 0; i < n; i++)
	{
		field[0][i] = '#';
		field[n - 1][i] = '#';
	}
	int playerx = 1;
	int playery = 1;
	field[playerx][playery] = '$';
	cin >> x >> y;
	field[x][y] = '0';
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < m; j++)
		{
			cout << field[i][j];
		}
		cout << endl;
	}
	int rastoyanie = sqrt(pow(abs(y - playery), 2) + pow(abs(playerx - x), 2 ));
	cout << rastoyanie;
}