fork download
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <ctime>
  4. using namespace std;
  5.  
  6. int main() {
  7.  
  8. srand(time(NULL));
  9. int a[10];
  10. int max=-100;
  11. for (int i=0; i<10; i++)
  12. {
  13. a[i]=rand()%200-100;
  14. if (a[i]>max)
  15. {
  16. max=a[i];
  17. cout<<max<<" ";
  18. }
  19.  
  20. }
  21. return 0;
  22. }
Success #stdin #stdout 0s 16064KB
stdin
Standard input is empty
stdout
-47 -27 51