Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <time.h>
- using namespace std;
- typedef int matr[4][8];
- typedef int mas[4];
- void input(matr a, int n, int m)
- {
- for (int i = 0;i < n;i++)
- for (int j = 0;j < m;j++)
- a[i][j] = 1 + rand() % 10;
- }
- void output(matr a, int n, int m)
- {
- for (int i = 0;i < n;i++)
- {
- for (int j = 0;j < m;j++)
- cout << a[i][j] << "|";
- cout << endl;
- }
- }
- void form(matr a, mas b, int n, int m)
- {
- for (int i = 0;i < n;i++)
- {
- b[i] = 0;
- for (int j = 0;j < m;j++)
- {
- int max = a[0][j];
- if (a[i][j] > max)
- max = a[i][j];
- b[i]++;
- }
- }
- }
- void output_mas(mas a, int m)
- {
- for (int i = 0;i < m;i++)
- cout << a[i] << "|";
- cout << endl;
- }
- int main()
- {
- setlocale(LC_ALL, "rus");
- matr a, b;
- mas p, q;
- input(a, 4, 8);
- cout << "МАТРИЦА А= " << endl;
- output(a, 4, 8);
- input(b, 4, 8);
- cout << "МАТРИЦА Б= " << endl;
- output(b, 4, 8);
- form(a, p, 4, 8);
- form(b, q, 4, 8);
- cout << "МАССИВ P" << endl;
- output_mas(p, 4);
- cout << "МАССИВ q" << endl;
- output_mas(q, 4);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement