Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
687 B
0
Indexable
Never
#include <iostream> 
using namespace std;
int main() {
	char mas[100][100];
	int n, m, x1, x0, y1, y0;
	cout << "RAZMERI DVORA ";
	cin >> n >> m;
	cout << '\n' << " KOORDINATI SHOHI ";
	cin >> x1 >> y1;
	cout << '\n' << " KOORDINATI TVOEGHO CIGANA ";
	cin >> x0 >> y0;
	for (int i = 0; i < m; i++){
		for (int j = 0; j < n;j++){
			if (i == 0 || i == m - 1 || j == 0 || j == n - 1) {
				mas[i][j] = '#';
			}
			else mas[i][j] = '.';
		}
	}
	mas[y1-1][x1-1] = '$';
	mas[y0 - 1][x0 - 1] = '*';
	for (int i = 0; i < m; i++) {
		for (int j = 0; j < n; j++){
			cout << mas[i][j] << ' ';
		}
		cout << '\n';
	}
	cout << '\n' << abs(x1 - x0) + abs(y1 - y0);


}