have been using C more habits, recently began to learn C + +, the beginning of the encounter problems. such as the following simple program, the use of string.
#include <iostream>
#include <string.h>
using namespace std;
int main ()
{
string str;
Cin >> str;
for (auto c:str)
cout << c << endl;
}
The VS hint error is as follows: Error 1 C2679: binary ">>": no operator (or no acceptable conversion) was found to accept the right operand of type std::string c:\users\likai\documents\visual Studio 2013\projects\ container \ Container \ Source. CPP 7 1 container
2 IntelliSense: There is no ">>" operator that matches these operands
Operand types are: Std::istream >> std::string c:\Users\likai\Documents\Visual Studio 2013\projects\ container \ Container \ source. CPP 7 6 containers
After careful review, the String,h header file in C is used in C + +, and in C + +, string and string.h files can exist at the same time, String.h is the header file in C. In C + +, mistaken for the possible, resulting in the operator pair >> string cannot be distinguished. Therefore, you should avoid including the. h file in C standard library in C + +.