Check out example codes for "how to format decimal palces in c++". It will help you in understanding the concepts better.

Code Example 1

std::cout << std::setprecision(2) << std::fixed;
// where the 2 is how many decimal places you want
// note you need to <iomanip>

Learn ReactJs, React Native from akashmittal.com