Sorry if my title was vague, im learning c++ and we're making a checkout/inventory system which calculates currency, if there is any change such as 1.69, it should automatically round up to 1.70 or if it was 1.63 it would round up to 1.65, avoiding giving change in cents.
Heres my relevant code that im attempting to adapt to return the correct rounding:
if (!taxed()) {
cout << price() * quantity();
}
else {
cout << (price() * quantity()) * 1.13;
}
Please note that i attempted cout precision with no success.
I managed to output to 1.7, but how do you change it to 1.70?
Tried changing the precision but that changed my answer, also setting it to double etc didnt help.