fork download
  1. #include <iostream>
  2. #include <stdio.h>
  3. using namespace std;
  4.  
  5. int n, x;
  6. int main()
  7. {
  8. while (1)
  9. {
  10. cin>>n;
  11. cout<<n<<endl;
  12. if ((n<10)||(n>99))
  13. {
  14. return 0;
  15. }
  16. if (n!=42)
  17. {
  18. cin>>n;
  19. cout<<n<<endl;
  20. if (n==42)
  21. {
  22. x+=1;
  23. }
  24. else
  25. {
  26. cin>>n;
  27. if (n==42)
  28. {
  29. cout<<n<<endl;
  30. x+=1;
  31. }
  32. }
  33. }
  34. if (x==3)
  35. {
  36. return 0;
  37. }
  38. }
  39.  
  40. return 0;
  41. }
Success #stdin #stdout 0s 15232KB
stdin
42
42
12
13
42
11
42
43
42
stdout
42
42
12
13
42
11
42
43
42