XCode 4 console won't take user input

前端 未结 3 1391
灰色年华
灰色年华 2021-01-03 06:30

In XCode 4, when I run something like this:

string input;
cout << \"Enter command\" << endl;
getline(cin, input);
cout << \"You entered: \"         


        
3条回答
  •  难免孤独
    2021-01-03 06:58

    Are you pressing Return or Enter at the end of your input line?
    For some keyboard the enter and return are on the same button, but if you press "shift" key, while pushing the enter/return button scanf will work.

    • Unshifted must be the Return
    • Shifted must be the Enter.

提交回复
热议问题