0
interrupt cin>>str while loop
when I use ctrl+d, it shows "process finished with exit code 0" and the code following the loop will never be excuted(the cout sentence). What if I want to continue execution of this program? string str; while(cin >> str); cout << "outside of the loop"; return 0 environment: CLion for Linux Thanks!
2 Antworten
+ 1
Add some condition to while loop. For example when user inputs some string "stop", you can do 'break;' and step out from the while loop.
0
@soman Yes it works, but I know from other place that ctrl + d should have solved the problem: it will interrupt the loop but not terminate the whole program. what's the result on your machine?