Advertisement
Guest User

Untitled

a guest
Oct 19th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4.  
  5. ifstream fin("NR1.TXT");
  6. ifstream gin("NR2.TXT");
  7.  
  8. int main()
  9. {
  10. int x,y;
  11. fin >>x; gin >>y;
  12. while(!fin.eof()&&!gin.eof()) {
  13. while(x<y && !fin.eof()) {
  14. if(x%5==0) cout <<x << " ";
  15. fin >> x;
  16. }
  17. while(y<x && !gin.eof()) {
  18. if(y%5==0) cout << y << " ";
  19. gin >> y;
  20. }
  21. while(x==y && (!fin.eof() && !gin.eof()))
  22. fin>>x,gin>>y;
  23. }
  24. while(!fin.eof())
  25. {
  26. if(x%5==0)
  27. cout<<x<<' ';
  28. fin>>x;
  29. }
  30. while(!gin.eof())
  31. {
  32. if(y%5==0)
  33. cout<<y<<' ';
  34. gin>>y;
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement