Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iomanip>
- #include <stdlib.h>
- #include <iostream>
- #include "ctime"
- #include "stdafx.h"
- #include <iomanip>
- #include <stdlib.h>
- #include <iostream>
- #include "ctime"
- using namespace std;
- const int n = 5;
- int adder(int[n][n]);
- void main()
- {
- srand(time(NULL));
- int array[n][n];
- for (int j = 0; j < n; j++)
- {
- for (int r = 0; r < n; r++)
- {
- array[j][r] = rand() % 20;
- }
- }
- for (int j = 0; j < n; j++)
- {
- for (int r = 0; r < n; r++)
- {
- cout << setw(3) << array[j][r];
- }
- cout << endl;
- }
- adder(array);
- cout << adder(array) << endl;
- }
- int adder(int iarray[n][n])
- {
- int counter = 0;
- int aa = 0;
- for (int j = 0; j < n; j++)
- {
- for (int r = 0; r < n; r++)
- {
- for (int l = 0; l < n; l++)
- {
- if ((iarray[r][j] == iarray[l][j]) && (r != l))
- counter++;
- }
- }
- if (counter > 0) aa++;
- }
- return aa;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement