+ 2
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
22nd Feb 2022, 12:57 PM
+ 1
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.
23rd Feb 2022, 3:18 PM
JRS - avatar
Hi 👋 Manav, https://code.sololearn.com/clEPPvKmo43O/?ref=app just some problems in your code, like the declaration of arr2..
22nd Feb 2022, 12:51 PM
Amine Laaboudi
Amine Laaboudi - avatar