Hi,
what does this error mean???How can i solve it??
please help a newbie!!!!!
thanks.
constraint for this code: no character arrays allowed;string ONLY.
this is the error:Code:#include<iostream> using std::cout; using std::cin; using std::endl; #include<string> using std::string; int main() { string time; int chk=0; int x =0; cout<<"enter time"<<endl; cin>>time; chk=time.find_first_of("1234567890"); if (chk!=-1) { cout<<"error!please reenter"<<endl; } else if (chk==-1) { cout<<"well done"<<endl; int x= atoi(time);// error on this line// cout<<x<<endl; } return 0; }
error C2664: 'atoi' : cannot convert parameter 1 from 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' to 'const char *'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
Error executing cl.exe.



LinkBack URL
About LinkBacks


