#include <iostream>
int main() {
const int DOLLAR = 100; //pennies per dollar
const int RATE = 12; //in perecent
int price = 0; //price of the product you are purchasing
int total_price = 0;
int cents = 0; //the amount of change left over
std::cout << "Please enter the price of the product you are purchasing($): ";
std::cin >> price;
total_price = price * ( DOLLAR + RATE ); //using formula ( 1 + rate ) multiplied by 100
std::cout << "After tax you owe " << total_price << " cents." << std::endl;
cents = total_price % DOLLAR;
total_price /= DOLLAR; //removing the cents
std::cout << "After tax you owe " << total_price << " dollars and " << cents << " cents." << std::endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKaW50IG1haW4oKSB7Cgljb25zdCBpbnQgRE9MTEFSID0gMTAwOyAvL3Blbm5pZXMgcGVyIGRvbGxhcgoJY29uc3QgaW50IFJBVEUgPSAxMjsgLy9pbiBwZXJlY2VudAoJaW50IHByaWNlID0gMDsgLy9wcmljZSBvZiB0aGUgcHJvZHVjdCB5b3UgYXJlIHB1cmNoYXNpbmcKCWludCB0b3RhbF9wcmljZSA9IDA7CglpbnQgY2VudHMgPSAwOyAvL3RoZSBhbW91bnQgb2YgY2hhbmdlIGxlZnQgb3ZlcgoJCglzdGQ6OmNvdXQgPDwgIlBsZWFzZSBlbnRlciB0aGUgcHJpY2Ugb2YgdGhlIHByb2R1Y3QgeW91IGFyZSBwdXJjaGFzaW5nKCQpOiAiOwoJc3RkOjpjaW4gPj4gcHJpY2U7CgkKCXRvdGFsX3ByaWNlID0gcHJpY2UgKiAoIERPTExBUiArIFJBVEUgKTsgLy91c2luZyBmb3JtdWxhICggMSArIHJhdGUgKSBtdWx0aXBsaWVkIGJ5IDEwMAoJCglzdGQ6OmNvdXQgPDwgIkFmdGVyIHRheCB5b3Ugb3dlICIgPDwgdG90YWxfcHJpY2UgPDwgIiBjZW50cy4iIDw8IHN0ZDo6ZW5kbDsKCQoJY2VudHMgPSB0b3RhbF9wcmljZSAlIERPTExBUjsKCXRvdGFsX3ByaWNlIC89IERPTExBUjsgLy9yZW1vdmluZyB0aGUgY2VudHMKCQoJc3RkOjpjb3V0IDw8ICJBZnRlciB0YXggeW91IG93ZSAiIDw8IHRvdGFsX3ByaWNlIDw8ICIgZG9sbGFycyBhbmQgIiA8PCBjZW50cyA8PCAiIGNlbnRzLiIgPDwgc3RkOjplbmRsOwoJCglyZXR1cm4gMDsKfQ==