Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <time.h>
- using namespace std;
- int main() {
- setlocale(LC_ALL, "ru");
- const int row = 3; // количество строк
- const int col = 5; // количество столбцов
- int arr[row][col];
- srand(time(NULL));
- for (int i = 0; i < row; i++) { // индекс строки
- for (int j = 0; j < col; j++) { // индекс столбца
- arr[i][j] = rand() % 100;
- cout << arr[i][j] << '\t';
- }
- cout << endl;
- }
- int max = arr[0][0];
- for (int i = 0; i < row; i++) {
- for (int j = 0; j < col; j++) {
- if (arr[i][j] > max) {
- max = arr[i][j];
- }
- }
- }
- cout << "Наибольший элемент в массиве - " << max << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment