Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | None | 0 0
  1. #include <fstream>
  2. using namespace std;
  3. ifstream in("numere25.in");
  4. ofstream out("numere25.out");
  5.  
  6. int main()
  7. {
  8.     int x,nr,last = 1;
  9.    
  10.     bool ok = false;
  11.    
  12.     in>>x;
  13.    
  14.     in>>nr;
  15.    
  16.     for(int i=1;i<nr;i++){
  17.         out<<i<<" ";
  18.         ok = true;
  19.     }
  20.    
  21.     last = nr;
  22.    
  23.     while(in>>nr)
  24.     {
  25.         for(int i = last+1;i<nr;i++){
  26.             out<<i<<" ";
  27.             ok = true;
  28.         }
  29.         last = nr;
  30.     }
  31.    
  32.     for(int i = last +1;i<=x;i++){
  33.         out<<i<<" ";
  34.         ok = true;
  35.     }
  36.    
  37.     if(!ok)
  38.         out<<"Nu exista"<<'\n';
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement