Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int const m = 11;
- int const n = 4;
- int a[m][n];
- for (int i = 0; i < m; i++) //заполнение
- {
- for (int j = 0; j < n; j++)
- {
- a[i][j] = rand() % 30 + 10;
- }
- }
- cout << "\t" << " A" << "\t" << "B" << "\t" << "C" << "\t" << "D" << endl; //строка с буквами
- for (int i = 0; i < m; i++)
- {
- cout << i + 1 << "\t" << "|"; //столбец с числами
- for (int j = 0; j < n; j++)
- {
- cout << a[i][j] << "\t";
- }
- cout << endl;
- }
- for (int i = 0; i < m; i++) //каждая параллель
- {
- int min = 100;
- for (int j = 0; j < n; j++)
- {
- if (a[i][j] < min)
- {
- min = a[i][j];
- }
- }
- cout << "least amount of people amongst " << i + 1 << " classes " << min << endl;
- }
- cout << endl;
- for (int j = 0; j < n; j++) //каждая буква
- {
- int min = 100;
- for (int i = 0; i < m; i++)
- {
- if (a[i][j] < min)
- {
- min = a[i][j];
- }
- }
- cout << "least amount of people amongst ";
- if (j == 0) //написание буквы класса
- {
- cout << "A";
- }
- else
- {
- if (j == 1)
- {
- cout << "B";
- }
- else
- {
- if (j == 2)
- {
- cout << "C";
- }
- else
- {
- if (j == 3)
- {
- cout << "D";
- }
- }
- }
- }
- cout << " classes " << min << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement