fork download
  1. #include <iostream>
  2. #include <limits>
  3. using namespace std; // consider removing this line in serious projects
  4.  
  5. int main() {
  6. auto func = [] () {
  7. int intNum = 0;
  8. cin >> intNum;
  9. cin.sync();
  10. while (intNum != 42) {
  11. cout << intNum << "\n";
  12. cin >> intNum;
  13. cin.sync();
  14. }
  15. };
  16. func();
  17.  
  18. return 0;
  19. }
Success #stdin #stdout 0s 15240KB
stdin
1 2 2 2 2 2 2
2
10
42
11
stdout
1
2
2
2
2
2
2
2
10