fork download
  1. #include <iostream>
  2.  
  3. int main() {
  4.  
  5. int i = 0;
  6. int cnt = 1;
  7. std::cin >> i;
  8. int max = i;
  9.  
  10. while( std::cin >> i )
  11. {
  12. ++cnt;
  13. if( i > max ) max = i;
  14. }
  15.  
  16. std::cout << "count=" << cnt
  17. << "\nmax=" << max << "\n";
  18.  
  19. return 0;
  20. }
Success #stdin #stdout 0s 3344KB
stdin
-2 4 9 6 -5 0  -1 
stdout
count=7
max=9