Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <cstdlib>
- using namespace std;
- void main()
- {
- const int n = 3, m = 4;
- int A[n][m];
- int sum = 0;
- for (int i = 0; i < n; i++)
- for (int j = 0; j < m; j++)
- {
- cout << " A [" << i + 1 << "]" << "[" << j + 1 << "]=";
- cin >> A[i][j];
- }
- for (int i = 0; i < n; i++)
- {
- for (int j = 0; j < m; j++)
- cout << setw(5) << A[i][j];
- cout << endl;
- }
- bool f;
- for (int i = 0; i < m; i++)
- {
- for (int j = 0; j < n; j++)
- {
- f = false;
- for (int k = j + 1; k < n; k++)
- {
- if (A[i][j] == A[i][k])
- {
- sum++;
- f = true;
- break;
- }
- }
- if (f) break;
- }
- }
- cout << "bla bla bla:" << sum;
- cin.get(); cin.get();
- }
Advertisement
Add Comment
Please, Sign In to add comment