XCode 4控制台不会接受用户输入 [英] XCode 4 console won't take user input

查看:350
本文介绍了XCode 4控制台不会接受用户输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在XCode 4中,当我运行这样的:

In XCode 4, when I run something like this:

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

我在控制台中看到我的Enter command提示。但是当我把鼠标光标放在它下面并开始键入光标不移动,我的击键不显示。它基本上就像一个只读文本框。我做错了什么?

I see my "Enter command" prompt in the console. But when I place my mouse cursor below it and start typing the cursor doesn't move, and my keystrokes don't show up. It basically behaves like a read-only text box. What am I doing wrong? How can I interact with my program as if it were running in the terminal?

推荐答案

您是否按返回

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.


  • 未移位必须为退货

  • 移位必须为Enter。

这篇关于XCode 4控制台不会接受用户输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆