Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include<time.h>
- #include <iomanip>
- #include <malloc.h>
- using namespace std;
- int main()
- {
- setlocale(0, "");
- const int n = 4;
- int matr[n][n];
- printf(" Вивiд матрицi:\n");
- for (int i = 0; i < n; i++)
- {
- for (int j = 0; j < n; j++)
- {
- matr[i][j] = rand() - 500 % 5;
- printf("%d\t", matr[i][j]);
- }
- printf("\n");
- }
- int mas[n];
- int LengthOfArray = sizeof mas / sizeof mas[0];
- for (int i = 0; i < n; ++i)
- {
- for (int j = 0; j < n; ++j)
- {
- if (i == 0) mas[j] = matr[i][j];
- else if (matr[i][j] > mas[j])
- mas[j] = matr[i][j];
- }
- }
- int count = 0;
- for (int* ptr = mas; ptr <= &mas[LengthOfArray - 1]; ptr++) {
- count++;
- printf("Стовбець %d. Адрес = %p\tЗначення = %d\n", count, ptr, *ptr);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment