fork download
  1. #include <iostream>
  2. #include <ctime>
  3. #include <cstdlib>
  4. using namespace std;
  5.  
  6. int main() {
  7. int array[100];
  8. srand(time(NULL));
  9. for (int &x : array) {
  10. x = -100 + rand() % 100;
  11. cout << x << ' ';
  12. }
  13. cout << endl;
  14. cout << endl;
  15. for (int x : array) {
  16. if (x % 2 == 0)cout << x << ' ';
  17. }
  18. cout << endl;
  19. return 0;
  20. }
Success #stdin #stdout 0s 2896KB
stdin
Standard input is empty
stdout
-43 -55 -16 -8 -31 -32 -76 -79 -87 -75 -97 -10 -88 -16 -29 -85 -91 -3 -90 -11 -22 -3 -35 -57 -39 -4 -44 -46 -62 -55 -14 -5 -58 -78 -12 -88 -10 -36 -67 -97 -11 -11 -54 -46 -75 -83 -79 -66 -86 -69 -77 -56 -20 -60 -13 -58 -12 -4 -52 -74 -7 -14 -26 -65 -92 -86 -53 -1 -22 -67 -46 -33 -26 -100 -27 -1 -31 -6 -67 -64 -23 -92 -68 -42 -99 -28 -48 -11 -32 -48 -32 -39 -62 -58 -52 -54 -44 -52 -3 -66 

-16 -8 -32 -76 -10 -88 -16 -90 -22 -4 -44 -46 -62 -14 -58 -78 -12 -88 -10 -36 -54 -46 -66 -86 -56 -20 -60 -58 -12 -4 -52 -74 -14 -26 -92 -86 -22 -46 -26 -100 -6 -64 -92 -68 -42 -28 -48 -32 -48 -32 -62 -58 -52 -54 -44 -52 -66