fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5.  
  6. int main()
  7. {
  8. int tab[20];
  9. int pkt = 3;
  10. int i = 0;
  11.  
  12. while (pkt > 0)
  13. {
  14. cin >> tab[i];
  15.  
  16. cout << tab[i] << endl;
  17.  
  18. if (tab[i] == 42 && tab[i - 1] != 42) --pkt;
  19.  
  20. i++;
  21. }
  22. return 0;
  23. }
Success #stdin #stdout 0s 3472KB
stdin
42
42
12
13
42
11
42
43
42
42
99
01
stdout
42
42
12
13
42
11
42