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