When there is a string value such as 3.76 how can this be converted into a int cent value in this case 376.
I was thinking of using sprintf to remove the dot then convert to int but can’t work out the syntax. How would I do this and is it the best way
removing the dot is rather easy:
will remove the dot.
To get an int, simply call the integer constructor:
Of course you can combined the two operations: