Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Matrix C++ matrix The city looks like an array of n rows and m columns, and each square in the array contains a house.

C++ Matrix

image text in transcribed
C++ matrix The city looks like an array of n rows and m columns, and each square in the array contains a house. Thus, each house will have 4 neighbors, if it is not right on the outskirts of the city. Suppose the matrix is the size of 6 x 5, and your friend lives in the house at the coordinates (2, 3). If we draw a diagram of the city in the form of a matrix, it will look like in the drawing below. Each value in the matrix represents the distance to the focus: 32123 21012 32123 43234 54345 65456 Requirement You are given the number of rows (n) and columns ( m) of the matrix that represents your city. In addition, you are given the line and column index of the house where your neighbor, suspected of having the flu, lives. Displays an array n x m containing, for each position (i, j), an integer representing the minimum distance from the neighbor's house coming from the delegation to the house on the position (i, i). Input data On the first line will be the numbers n and m, separated by a space, representing the dimensions of the matrix. On the second line there will be 2 other integers separated by space, representing the line and column index of the neighbor's house. Output data An array of n rows and m columns will be displayed , with items on a line separated by spaces. Each element in the matrix represents the minimum distance to the focus, as required. Restrictions and clarifications 1 s n, m s 100 The numbering of rows and columns starts at 1 1 s line index of the neighbor s house s n 1 s column index of the neighbor s house s m

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions

Question

Describe the error in finding the sum. 1. 2.

Answered: 1 week ago

Question

How is slaked lime powder prepared ?

Answered: 1 week ago

Question

Why does electric current flow through acid?

Answered: 1 week ago

Question

What is Taxonomy ?

Answered: 1 week ago

Question

1. In taxonomy which are the factors to be studied ?

Answered: 1 week ago