Eddie_1337

Untitled

May 27th, 2018
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.32 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3.  
  4. using namespace std;
  5.  
  6. int v[10];
  7.  
  8. int main() {
  9.     fstream f("bac.txt");
  10.     int x, max = 0, nr_ord = 0, c = 0;
  11.     while (f >> x) {
  12.         c++;
  13.         v[x / 10 % 10]++;
  14.         if (v[x / 10 % 10] > max) {
  15.             max++;
  16.             nr_ord = c;
  17.         }
  18.     }
  19.     cout << nr_ord << '\n';
  20.     f.close();
  21.     system("pause");
  22. }
Advertisement
Add Comment
Please, Sign In to add comment