【问题标题】:Cin not working? I indentified the string辛不工作?我确定了字符串
【发布时间】:2015-02-18 01:11:09
【问题描述】:
cout << "Please enter the name you wish to have: ";
string Name;
cin >> Name;

我已经识别了字符串,但是我收到了 cin 的错误,说 'error C2679: binary '>>': no operator found which take a right-hand operand of type 'std::string' (或者有没有可接受的转换)。'

显然,我是初学者,所以任何帮助都会很棒,谢谢。

【问题讨论】:

标签: c++


【解决方案1】:

您正在使用 Visual Studio,但忘记了

#include <string>

【讨论】:

  • 我真的很蠢,我以为我试过了,但没用,但是,唉,我不是一个聪明的人。谢谢!
  • @tiert 始终包含您使用的函数和类型的正确标题。
猜你喜欢
  • 2016-08-23
  • 2016-11-09
  • 2016-04-28
  • 1970-01-01
  • 1970-01-01
  • 2013-06-02
  • 1970-01-01
  • 2021-03-28
  • 2023-03-11
相关资源
最近更新 更多