Use `find` method to get the index of decimal point and use it with `substr` method to "split" the string in two, before converting to `int` using `stoi`. https://code.sololearn.com/c2PLHNpah7bN/?ref=app
The problem is in your first “for” loop. You are trying to copy a string to an int array. When you have “arr[i]=str[i]”, this doesn’t assign the digit you want to arr. Try debugging by using cout << str[i] << “ “ << arr[i] or something in that loop and you’ll see what I mean. So you need to figure out how to extract a digit from a string.