Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- const int n = 5;
- const int m = 5;
- using namespace std;
- int func_arr(int tmp[], int size);
- int main()
- {
- const int size = 10;
- const int n = 10; const int m = 10;// размер масcива
- int arr[size];
- int tmp[size];
- int mat[n][m];
- for (int i = 0; i < n; i++) {
- for (int j = 0; j < m; j++) {
- mat[i][j] = i - j;
- }
- }
- for (int i = 0; i < n; i++) {
- for (int j = 0; j < m; j++) {
- cout << mat[i][j] << "\t";
- }
- cout << endl;
- }
- cout << "New array" << endl;
- for (int j = 0; j < m; j++)
- {
- for (int i = 0; i < n; i++) {
- tmp[i] =mat[i][j];
- }
- arr[j] = func_arr(tmp, size);
- cout << arr[j] << "\t";
- }
- return 0;
- }
- int func_arr(int tmp[], int size)
- { int count=0;
- for (int i = 0; i < size; i++)
- if (tmp[i] > 0) {
- count = count + 1;
- }
- return count;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement