operator >>和<< not recognized

Jas*_*sSy 0 c++ compiler-errors

我对c ++很陌生,试图掌握它.以下代码是教程的精确副本,其中代码适用于教师.但我的IDE(Visual Studio)返回错误说:

Error: No operator ">>" matches these operands. 
Error: No operator "<<" matches these operands. 
Run Code Online (Sandbox Code Playgroud)

我错过了什么?

我的守则

#include <iostream>

using namespace std;

int main() {

    cout << "Enter you name" << flush;

    string input;
    cin >> input; //Error as above message

    cout << "your name is " << input << endl; //Error message on the << operator before input

    cin.get();

    return 0;
}
Run Code Online (Sandbox Code Playgroud)

Pau*_*zie 5

你没有这样做:

#include <string>

如果你正在使用std::string,那么你应该总是#include <string>.

另外,我使用Visual Studio 2013编写了代码,但没有<string>包含头文件.这是错误:

错误C2679:二进制'>>':找不到哪个运算符采用'std :: string'类型的右手操作数(或者没有可接受的转换)