简单问题 哪里错了....我菜鸟
#include<iostream>#include<cstring>
int main()
{
using namespace std;
cout<<"Enter a word:";
string word;
cin>>word;
char temp;
int i,j;
for(j=0,i=word.size()-1;j<i;--i,++j)
{
temp=word[i];
word[i]=word[j];
word[j]=temp;
}
cout<<word<<"\nDone\n";
return 0;
}
E:\Program Files\Microsoft Visual Studio\MyProjects\1111\111.cpp(8) : error C2679: binary '>>' : no operator defined which takes a right-hand operand of type 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' (
or there is no acceptable conversion)
E:\Program Files\Microsoft Visual Studio\MyProjects\1111\111.cpp(17) : error C2679: binary '<<' : no operator defined which takes a right-hand operand of type 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
(or there is no acceptable conversion)