Reading a string in C ++
In the compiler, Dev C++
I can write and successfully compile this:
#include <iostream>
#include <string>
using namespace std;
int main ()
{
string method;
cin >> method;
return 0;
}
but when i wrote the code above in Visual Studio 2013 (console app mode)
i got this error:
Error: no operator ">>" matches these operands
operand types are: std::istream >> std::string
EDIT
in Visual Studio
:
#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
string method;
cin >> method;
return 0;
}
I understand what he says about the error. But why only Visual Studio 2013
?
+3
source to share