ورود

View Full Version : مشکل با string



roteil
یک شنبه 19 تیر 1390, 00:00 صبح
سلام من وقتی این برنامه را می نویسم با این error مواجه میشم

1>test string\test.cpp(8) : error C2679: binary '>>' : no operator found which takes a right-hand operand of type 'std::string' (or there is no acceptable conversion)

#include <iostream>
#include <conio.h>
#include <string.h>
using namespace std;
int main(){
string str;
cout<<"Enter a name :\n";
cin>>str;
cout<<str<<endl;
getch();
}

visual studio 2008
ممنون

r00tkit
یک شنبه 19 تیر 1390, 09:06 صبح
string رو بدون .h اینکلود کن یعنی این


#include <iostream>
#include <conio.h>
#include <string>
using namespace std;
int main(){
string str;
cout<<"Enter a name :\n";
cin>>str;
cout<<str<<endl;
getch();
}