Advertisement
Balda

Untitled

Jul 6th, 2016
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.     int Array[10], Current = -1, ArrayMax = 1;
  7.  
  8.     cout << "Enter array elements (10) :" << endl;
  9.  
  10.     for (int i = 0; i < 10; i++) cin >> Array[i];
  11.  
  12.     cout << endl;
  13.     for (int i = 0; i < 10; i++)
  14.     {
  15.         int Counter = 0;
  16.         for (int j = i; j < 10; j++)
  17.         {
  18.             if (Array[i] == Array[j])
  19.                 Counter++;
  20.         }
  21.  
  22.         if (ArrayMax < Counter)
  23.         {
  24.             ArrayMax = Counter;
  25.             Current = i;
  26.         }
  27.     }
  28.  
  29.     if (Current > -1) cout << Array[Current] << endl;
  30.     else cout << "No repeating elements" << endl;
  31.    
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement