C++ Taskbook Level 10.8

Задание 1

Write a program that will check whether it is possible to obtain from one string another by rearranging its letters.

Задание 2

Implement the Eratosthenes algorithm to find prime numbers in a given interval.

Задание 3

Given an arbitrary two-dimensional array:

cpp{
  {11, 12, 13, 14, 15},
  {21, 22, 23, 24, 25},
  {31, 32, 33, 34, 35},
  {41, 42, 43, 44, 45},
  {51, 52, 53, 54, 55},
}

Swap the two given rows:

cpp{
  {51, 52, 53, 54, 55},
  {21, 22, 23, 24, 25},
  {31, 32, 33, 34, 35},
  {41, 42, 43, 44, 45},
  {11, 12, 13, 14, 15},
}
Задание 4

Given an arbitrary two-dimensional array:

cpp{
  {1, 2, 3, 4, 5},
  {1, 2, 3, 4, 5},
  {1, 2, 3, 4, 5},
  {1, 2, 3, 4, 5},
  {1, 2, 3, 4, 5},
}

Get the sum of the columns of this array. Present the result as an array of sums:

cpp{
  5, 10, 15, 20, 25
}
Задание 5

Given a string containing any number of nested paired parentheses, write code that will check that the parentheses are positioned correctly.

This is correct:

cpp"()()"

This is correct:

cpp"(())"

This is incorrect, since the number of open brackets does not match the number of closed ones:

cpp"())"

This is incorrect, because although the number of open brackets matches the number of closed ones, they are in the wrong order:

cpp"))(("