In my project, I am taking the surface area and turning that into dollars and cents. For example
Total surface area to be painted: 74691.87095 square inches.
Your painting cost is: $74 and 69 cents.
Total surface area to be painted: 44998.11992 square inches.
Your painting cost is: $45 and 0 cents.
My code reads
int roundcost = Area*.001;
int cents = roundcost % 100;
cout << "Your total cost is:" << roundcost << " and" << cents << "cents" << endl;
why is my code wrong? how can i fix it to get to the correct examples
Last edited on
also area is the variable for surface area
int cents = Area / 10;
int dollars = cents / 100;
cents = cents % 100;