#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
void a(vector<vector<int>> arr) {
unsigned long long int min = 18446744073709551615;
for(int i = 0; i<arr[4].size(); ++i) {
if(arr[4][0]<min) {
min = arr[4][0];
}
cout << endl << "Min: " << min;
void b(vector<vector<int>> arr, int x, int y) {
int max = -1;
for(int i = 0; i<x; ++i) {
if(arr[i][3]>max) {
max = arr[i][3];
cout << endl << "max: " << max;
int main() {
srand(123);
cout << "Array x*y. Enter x: ";
int x = 0;
cin >> x;
cout << "Enter y: ";
int y = 0;
cin >> y;
if(x<5||y<4) {
cout << "Wrong data. x<5 or y<4";
return 0;
vector<vector<int>> arr;
vector<int> temp;
temp.push_back(rand());
arr.push_back(temp);
for(int j = 0; j<y; ++j) {
arr[i].push_back(rand());
for(int j = 0; j<x; ++j) {
cout << arr[i][j] << " ";
if(j==x-1) {
cout << endl;
a(arr);
b(arr, x, y);
Copyright © 2025 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Verified answer
#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
void a(vector<vector<int>> arr) {
unsigned long long int min = 18446744073709551615;
for(int i = 0; i<arr[4].size(); ++i) {
if(arr[4][0]<min) {
min = arr[4][0];
}
}
cout << endl << "Min: " << min;
}
void b(vector<vector<int>> arr, int x, int y) {
int max = -1;
for(int i = 0; i<x; ++i) {
if(arr[i][3]>max) {
max = arr[i][3];
}
}
cout << endl << "max: " << max;
}
int main() {
srand(123);
cout << "Array x*y. Enter x: ";
int x = 0;
cin >> x;
cout << "Enter y: ";
int y = 0;
cin >> y;
if(x<5||y<4) {
cout << "Wrong data. x<5 or y<4";
return 0;
}
vector<vector<int>> arr;
for(int i = 0; i<x; ++i) {
vector<int> temp;
temp.push_back(rand());
arr.push_back(temp);
for(int j = 0; j<y; ++j) {
arr[i].push_back(rand());
}
}
for(int i = 0; i<x; ++i) {
for(int j = 0; j<x; ++j) {
cout << arr[i][j] << " ";
if(j==x-1) {
cout << endl;
}
}
}
a(arr);
b(arr, x, y);
}