fork(3) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int liczba;
  7. bool czy_pop = true;
  8. int ile_razy=0;
  9.  
  10. while (ile_razy<3)
  11. {
  12. cin >> liczba;
  13.  
  14. if (czy_pop==false&&liczba==42)
  15. {
  16. cout << liczba << endl;
  17. czy_pop = true;
  18. ile_razy++;
  19. }
  20.  
  21. if (liczba!=42)
  22. {
  23. czy_pop = false;
  24. cout << liczba << endl;
  25. }
  26. }
  27.  
  28. return 0;
  29. }
Success #stdin #stdout 0s 3464KB
stdin
42
42
12
13
42
11
42
43
42
42
99
01
stdout
12
13
42
11
42
43
42