a53

Numere25

a53
Jan 8th, 2019
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. #include <fstream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int n,x;
  7. bool ok=true;
  8. ifstream f("numere25.in");
  9. f>>n;
  10. f>>x;
  11. ofstream g("numere25.out");
  12. for(int i=1;i<=n;++i)
  13. {
  14. if(i>x)
  15. while(f>>x&&i>x);
  16. if(i!=x)
  17. g<<i<<' ',ok=false;
  18. }
  19. f.close();
  20. if(ok)
  21. g<<"Nu exista";
  22. g.close();
  23. return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment