Advertisement
Stancu

V89 III pv 4

Nov 12th, 2019
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     int i, x, v[100], k;
  9.  
  10.     ifstream f("bac.txt");
  11.  
  12.     while (f >> x)
  13.     {
  14.         v[x]++;
  15.     }
  16.  
  17.     cin >> k;
  18.  
  19.     for(i = 99; i > k; i--)
  20.     {
  21.         if(v[i])
  22.             cout << i;
  23.     }
  24.  
  25.     // daca i apare de mai multe ori pentru al scrie pe i
  26.     /*
  27.     while(v[i])
  28.     {
  29.         cout << i << " ";
  30.         v[i]--;
  31.     }*/
  32.  
  33.  
  34.  
  35.     return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement