We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Fixed: makes cout print floats with a fixed number of decimals (do not automatically change amount of decimal places i.e. via automatically rounding etc).
Precision: used to set the amount of decimal places needed (manually set the amount of decimal places required).
Therefore if we set precision first, then cout with fixed, we are guranteed to print out all decimal values as is (fixed) with the correct number of required decimal places (precision).
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Basic Data Types
You are viewing a single comment's thread. Return to all comments →
Fixed: makes cout print floats with a fixed number of decimals (do not automatically change amount of decimal places i.e. via automatically rounding etc).
Precision: used to set the amount of decimal places needed (manually set the amount of decimal places required).
Therefore if we set precision first, then cout with fixed, we are guranteed to print out all decimal values as is (fixed) with the correct number of required decimal places (precision).