fork(1) download
  1. #include <iostream>
  2.  
  3. int main()
  4. {
  5. int choice;
  6. std::cout << "Enter choice 1 or 2: ";
  7. std::cin >> choice;
  8. if ( choice == 1 )
  9. goto CHOSE1;
  10. else if ( choice == 2 )
  11. goto CHOSE2;
  12. else {
  13. std::cout << "It was a simple enough question!\n";
  14. goto END;
  15. }
  16.  
  17. CHOSE1:
  18. std::cout << "Chose 1\n";
  19. goto END;
  20.  
  21. CHOSE2:
  22. std::cout << "Chose 2\n";
  23. goto END;
  24.  
  25. END:
  26. std::cout << "Here we are at end\n";
  27. }
  28.  
Success #stdin #stdout 0s 3344KB
stdin
2
stdout
Enter choice 1 or 2: Chose 2
Here we are at end