c++ - 为什么 cin >> string 不能与 Visual C++ 2010 一起使用?

标签 c++ string cin

#include <iostream>

using namespace std;

int main() {
    string s;
    cin >> s;
    cout << "Hello World!";
}

这行不通。为什么?

最佳答案

因为你忘了#include <string>

关于c++ - 为什么 cin >> string 不能与 Visual C++ 2010 一起使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5343035/

相关文章:

c++ - 指向整数数组的指针

java - String.matches ("(\\w)\\1") 在对长度超过 100 的字符串进行某些执行尝试后给出不一致的结果

没有 root 访问权限的 linux 服务器上的 C++11 兼容编译器?

c++ - WASAPI:识别环回记录中的非事件 channel

ruby - 在 Vagrant 配置期间使用 Sed 将行附加到文件

C++11 : cin doesn't wait for user input and ends the loop

c++ - 如何获得一组带有空格的单词作为 C 中的一个输入?

c++ - cin 作为 while 循环中的条件?

c++ - Rcpp并行: Converting CharacterMatrix to RMatrix<T>

java.lang.NumberFormatException : empty String 异常