conveting string to decimal

In my project i have to take the string valve and convert it into float
for example
100 will be 100.00
100.0012 will be invalid
100.00 will stay as it is
99 will be 99.00
i m thinking of using stof but i m stuck on how to set the precision of 2
you will also need to use a fixed declaration before it cout << fixed << setpreciosion(2) << x
Last edited on
Topic archived. No new replies allowed.