aimon1337

Untitled

Mar 20th, 2021 (edited)
432
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4.  
  5. ifstream fin("bac.txt");
  6. int main()
  7. {
  8.    int frecv[101]={0}, a, i, j = -1, ok, ok2;
  9.    ok=ok2=0;
  10.     while (fin >> a)       
  11.         frecv[a]++;    
  12.     for (i = 0; i <= 100; i++) 
  13.     {
  14.         if (!(frecv[i]))   
  15.             ok++;
  16.         else           
  17.         {
  18.             if (ok >= 1 && j != -1)
  19.             {
  20.                 cout << j << " " << i << '\n'; 
  21.                 ok2++;     
  22.                 j = i;     
  23.                 ok = 0;    
  24.             }
  25.             else
  26.             {
  27.                 j = i;     
  28.                 ok = 0;    
  29.             }
  30.         }
  31.     }
  32.     if (ok2 == 0)      
  33.         cout << "Nu exista";
  34.     fin.close();       
  35.     return 0;
  36. }
Add Comment
Please, Sign In to add comment