fork download
  1. #include <fstream>
  2. #include <iostream>
  3.  
  4. int main()
  5. {
  6. std::ifstream is("a.txt");
  7. int x, max = 0;
  8.  
  9. while (is >> x)
  10. if (!(x % 5) && x > max)
  11. max = x;
  12.  
  13. if (!max)
  14. std::cout << "there is no max";
  15. else
  16. std::cout << "The max is: " << max;
  17.  
  18. is.close();
  19. }
Success #stdin #stdout 0s 5672KB
stdin
Standard input is empty
stdout
there is no max