Untitled

 avatar
unknown
plain_text
2 years ago
1.1 kB
1
Indexable
#include <iostream>
using namespace std;
int main()
{
	int n, m, x1, y1, x0, y0, q, w;
	float penis;
	cin >> m >> n;
	cin >> x1 >> y1;
	cin >> x0 >> y0;
	char a[100][100];

	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < m; j++)
		{
			

			if (i == 0 || i == n - 1) {
				if (i == 0) {
					a[0][j] = '#';
				}
				if (i == n-1) {
					a[n-1][j] = '#';
				}
				
			}
			else {
				
				if (i != 0 || i != m - 1) {
					a[i][j] = '.';
				}
				if (j == 0 || j == m - 1) {
					a[i][j] = '#';
				}
				if (i == x1 && j == y1) {
					a[i][j] = '$';
				}
				if (i == x0 && j == y0) {
					a[i][j] = '*';
				}
			}
			

		}
	}
	if (x1 > x0) {
		if (y1 > y0) {
			q = x1 - x0;
			w = y1 - y0;
		}
		if (y1 < y0) {
			q = x1 - x0;
			w = y0 - y1;
		}
	}
	if (x1 < x0) {
		if (y1 > y0) {
			q = x0 - x1;
			w = y1 - y0;
		}
		if (y1 < y0) {
			q = x0 - x1;
			w = y0 - y1;
		}
	}
	penis = sqrt(pow(q+1, 2) + pow(w+1, 2));
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < m; j++)
		{
			cout << a[i][j];
		}
		cout << endl;
	}
	cout << penis;
}
Editor is loading...