Ответы на вопрос:
Насколько я понимаю - это означает, что - Не нужно самому городить дополнительные ограничительные барьеры и уметь пользоватьься всеми моментами, которые тебе предоставляет жизнь.
Объяснение:
#include <iostream>
#include <ctime>
#include <cstdlib>
using namespace std;
const int SIZE = 5;
void fillAndShowArray(int[][SIZE], const int size);
int findMinElement(int[][SIZE], const int size);
int findMaxElement(int[][SIZE], const int size);
int main()
{
setlocale(LC_ALL, "rus");
int matrix[SIZE][SIZE] = {};
fillAndShowArray(matrix, SIZE); //заполняем и показываем массив
cout << endl;
cout << "Минимум: " << findMinElement(matrix, SIZE) << endl;
cout << "Максимум: " << findMaxElement(matrix, SIZE) << endl;
return 0;
}
void fillAndShowArray(int arr[][SIZE], const int size)
{
for (int i = 0; i < size; i++)
{
cout << "| ";
for (int j = 0; j < size; j++)
{
arr[i][j] = 30 + rand() % 31;
cout << arr[i][j] << " ";
}
cout << " |" << endl;
}
}
int findMinElement(int arr[][SIZE], const int size)
{
int min = arr[0][0];
for (int i = 0; i < size; i++)
{
for (int j = 0; j < size; j++)
{
if (arr[i][j] < min)
min = arr[i][j];
}
}
return min;
}
int findMaxElement(int arr[][SIZE], const int size)
{
int max = arr[0][0];
for (int i = 0; i < size; i++)
{
for (int j = 0; j < size; j++)
{
if (arr[i][j] > max)
max = arr[i][j];
}
}
return max;
}
Популярно: Другие предметы
-
Marchosias24.09.2022 22:20
-
dmitrijcazovo8130.10.2020 09:30
-
Raptilla15.01.2020 20:38
-
Виолетта220911.01.2020 16:00
-
milna115.05.2021 07:56
-
DashkaaMilashka28.09.2021 02:43
-
margo34431.12.2021 15:06
-
марго39820.04.2023 20:45
-
anyapletneva017.09.2021 06:37
-
ученик189011.12.2020 17:13