I am making this program for a fake store that will take the price of an item and add it to the other items you put in and then multiply by sales tax. I was just wondering how i could round everything off to the 100th. For example, if the price of the item was 1.25 and that was all they bought, 1.25 * .0825 is 1.66562. I would like it to read 1.67. Here is the code so far.
Code:#include <iostream> using namespace std; main() { const float SALESTAX = .0825; float totalprice; float totalpricewithouttax; float item1; float item2; float item3; float item4; float item5; cout<<"Enter the price of an item: "; cin>> item1; if (item1 < 0) { cout<<"You must enter a price"; return 1; } if (item1 > 0) { cout<<"If this is the only item being bought, enter 0. If not, enter the price for item 2: "; } cin>> item2; if (item2 == 0) { totalpricewithouttax= item1; totalprice= (item1) * (item1 + SALESTAX); cout<< "The price is "<< totalpricewithouttax<< endl; cout<< "The total ammount due is "<< totalprice << endl; } }