+ 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..