Advertisement
TroubleMaker84

Untitled

May 26th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     ifstream f("BAC.txt");
  8.     int x, v[100000],y, i=1,j,a,Vmax=0;
  9.     while(f>>x)
  10.     {
  11.         v[i]=(x/10)%10;
  12.         a=0;
  13.         for(j=1;j<=i;j++)
  14.             if(v[i]==v[j])
  15.                 a++;
  16.         if(a>=Vmax)
  17.             {Vmax=a;  y=i;}
  18.         i++;
  19.     }
  20.     cout<<y;
  21.     f.close();
  22.     return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement