Initial commit

This commit is contained in:
2026-02-25 18:10:23 +03:00
commit de343e911e
11 changed files with 421 additions and 0 deletions

56
src/lab5.cpp Normal file
View File

@@ -0,0 +1,56 @@
#include <labs.h>
constexpr size_t LEN = 5;
void lab5()
{
int arr[LEN][LEN], d_min, d_max, d_count, v_max_i, v_max_j;
cout << "Enter range min: ";
cin >> d_min;
cout << "Enter range max: ";
cin >> d_max;
for (size_t i = 0; i < LEN; i++)
for (size_t j = 0; j < LEN; j++)
{
cout << "Enter arr[" << i << "][" << j << "]: ";
cin >> arr[i][j];
}
v_max_i = v_max_j = 0;
d_count = 0;
for (size_t i = 0; i < LEN; i++)
for (size_t j = 0; j < LEN; j++)
{
if (d_min <= arr[i][j] && arr[i][j] <= d_max)
d_count++;
if (arr[i][j] > arr[v_max_i][v_max_j])
{
v_max_i = i;
v_max_j = j;
}
}
cout << "Matrix is {" << endl;
for (size_t i = 0; i < LEN; i++)
{
for (size_t j = 0; j < LEN; j++)
{
cout << '\t' << arr[i][j];
if (j < LEN - 1)
cout << ",";
}
cout << endl;
}
cout << "}" << endl;
cout << "Number of elements in range [" << d_min << "; " << d_max << "] is " << d_count << endl;
cout << "Highest element in array is arr[" << v_max_i << "][" << v_max_j << "] = " << arr[v_max_i][v_max_j] << endl;
}