Hello. My program calculates and displays data for a restaurant bill. However, I wanted to how to prevent anything after the hundredths place from being displayed. I tried using setprecision but I am still confused. Maybe I'm using it correctly. I do not want to round the numbers at the hundredths place, I just want to exclude anything after the hundredths place.
You want cout<<setprecision(2) not four (two decimal places), and you don't need to pass endl after it (it doesn't print anything to the console). To ensure you get trailing zeros (up to the precision amount) do std::cout << std::fixed; before printing the numbers.