fork(2) download
  1. #include <iostream>
  2. using namespace std;
  3. int v1;
  4. int v2;
  5. int testy=0;
  6. int main() {
  7.  
  8. while(testy <4) {
  9. v2=v1;
  10. cin>>v1;
  11.  
  12. if(v1 == 42 && v2 !=42) {
  13. testy++;
  14. }
  15. cout<<v1<<endl;
  16. // cout<<"stan licznika "<<testy<<endl;
  17. // cout<<v2<<endl;
  18. }
  19. }
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
43
42