Advertisement
hopingsteam

Untitled

May 4th, 2020
1,338
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.74 KB | None | 0 0
  1. #include    <iostream>
  2. #include    <fstream>
  3.  
  4. using namespace std;
  5.  
  6. ifstream fin("fisier.in");
  7. /*
  8.  * V[3] - v[0] v[1] v[2]
  9.  * Numar prim
  10.  * CMMDC
  11.  * Factori primi
  12.  * Descompunerea unui nr in cifre (suma, palindrom, ...)
  13.  * Fibonacci
  14.  * Vectori (inserare, stergere, ...)
  15.  * Matrici (parcurgere pe coloane)
  16.  */
  17.  
  18. int AP[10];
  19. int PozAP[10];
  20.  
  21. int main()
  22. {
  23.     int nr, contor = 1;
  24.     while(fin >> nr)
  25.     {
  26.         int uc = nr % 10;
  27.         AP[uc]++;
  28.         PozAP[uc] = contor;
  29.  
  30.         contor++;
  31.     }
  32.    
  33.     int max = 0;
  34.  
  35.     for(int i = 0; i <= 9; i++)
  36.         if(AP[i] > max)
  37.             max = AP[i];
  38.  
  39.     for(int i = 0; i <= 9; i++)
  40.         if(AP[i] == max)
  41.             cout << PozAP[i] << " ";
  42.  
  43.     return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement