123456
cout << "Subtotal: " << subTot<< endl; //Outputs Subtotal tax = preTax * 0.05; //Calculates tax as 5% of the subtotal cout << "Tax is: " << tax << endl; //Outputs tax postTax = preTax + tax; //Adds tax to subtotal for final total cout << "Total Amount Due: " << totalDue << endl; //outputs final total }
setprecision()
#include <iomanip>