B
B
bek7an2020-11-23 09:38:21
C++ / C#
bek7an, 2020-11-23 09:38:21

The C++ matrix needs to be done exactly as in the photo (which is in the center) And replace the numbers that indicate the arrows with the numbers SU.?

5fbb57fb588d7852642120.jpeg

Answer the question

In order to leave comments, you need to log in

3 answer(s)
N
NIKITF, 2021-09-02
@NIKITF

#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
  srand(unsigned(time(0)));
  size_t n = 2 * rand() % 6 + 5, m = n;
  int** array = new int* [n];
  for (auto x = 0; x < n; x++)
  {
    array[x] = new int[m];
  }
  for (size_t x = 0; x < n; x++)
  {
    for (size_t y = 0; y < m; y++)
    {
      array[x][y] = 0;
    }
  }
  unsigned h = 1; int p = 1;
  for (size_t y = 0; y < m / 2; y++)
  {
    if (n - h == 0)
    {
      break;
    }
    for (size_t r = h; r < n - h; r++)
    {
      array[r][y] = p++;
    }
    h++;
  }
  for (size_t y = m / 2; y < m; y++)
  {
    if (n - h == 0)
    {
      break;
    }
    for (size_t r = h; r < n - h; r++)
    {
      array[r][y] = p++;
    }
    h--;
    if (!h)
    {
      break;
    }
  }

  for (size_t x = 0; x < n; x++)
  {
    for (size_t y = 0; y < m; y++)
    {
      cout << setw(5) << array[x][y];
    }
    cout << endl;
  }
  return 0;
}

O
Oleg Tsilyurik, 2016-09-28
@Olej

Which linux distribution to choose?

Any. All the talk about some radical difference is blah blah blah.
The selection criteria can be:
- the number of users, the size of the community
- the availability of documentation, descriptions If you
want the latest - install Fedora.
If you want a minimum of hassle, install Mint.

A
Artemy, 2016-09-28
@MetaAbstract

Depends on goals. Install the required stability with Debian.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question