hello everyone,
I've been trying to solve this problem but there was no use.It gives this error: "'atoi' : cannot convert parameter 1 from 'std::string' to 'const char *'".Am I doing something wrong?
int main()
{
int x,y;
string input,input1;
cout<<"Please enter the coordinates "<<endl;
cin >> input;
if((input.at(0) == '(') && (input.at(input.length()-1) == ')'))
{
int pos= input.find(',');
int pos_reverse= input.rfind(',');
if (( pos != string::npos) && (pos_reverse == pos))
{
string xstr,ystr;
xstr = input.substr(1, pos-1);
ystr = input.substr(pos+1, input.length()-pos-2);
if( inputcheck(xstr) && inputcheck(ystr))
{
x = atoi(xstr);
y = atoi(ystr);
}
}
}