Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- #define N 5
- #define M 3
- int c_unique(const int* arr, int size) {
- int cnt = 0;
- for(int i = 0; i < size; i++) {
- for(int j = 0; j < size; j++) {
- if(arr[j] == arr[i])
- cnt++;
- }
- if(cnt > 1)
- return 0;
- cnt = 0;
- }
- return 1;
- }
- int main(void) {
- int masiv[N][M], i, j, b;
- for(i = 0;i < N; i++) {
- for(j = 0;j < M;j++) {
- masiv[i][j] = rand()%11;
- cout<<masiv[i][j]<<"\t";
- }
- cout << endl;
- }
- for(b = i = 0; i < N; i++)
- b += c_unique(masiv[i], M);
- cout <<"b="<< b << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement