Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- using namespace std;
- int main()
- {
- setlocale(LC_ALL, "Russian");
- int e;
- int mas[100];
- cout << "Введите размер массива: ";
- cin >> e;
- for (int a = 0; a < e; a++)
- {
- cin >> mas[a];
- }
- cout << endl;
- for (int a = 0; a < e; a++)
- {
- cout << mas[a] << " ";
- }
- cout << endl;
- int current_max = 0, old_max = 0;
- for (int i = 0; i < e - 1; i++)
- {
- for (int b = 0; b < e; b++)
- {
- if (mas[i] == mas[b])
- current_max++;
- }
- cout << current_max << endl;
- if (current_max > old_max)
- old_max = current_max;
- current_max = 0;
- }
- cout << "Максимальное количество одинаковых элементов: " << old_max << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment