+ 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
+ 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.
0
Hi đ Manav,
https://code.sololearn.com/clEPPvKmo43O/?ref=app
just some problems in your code, like the declaration of arr2..