Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main() {
- const double MAGNOLIA_PRICE = 3.25;
- const double HYACINTH_PRICE = 4.00;
- const double ROSE_PRICE = 3.50;
- const double CACTUS_PRICE = 8.00;
- const double TAX_PROFIT = 0.05;
- int magnoliaCount, hyacinthCount, roseCount, cactusCount;
- cin >> magnoliaCount >> hyacinthCount >> roseCount >> cactusCount;
- double giftPrice;
- cin >> giftPrice;
- double totalSum = (MAGNOLIA_PRICE * magnoliaCount + HYACINTH_PRICE * hyacinthCount + ROSE_PRICE * roseCount + CACTUS_PRICE * cactusCount) * (1 - TAX_PROFIT);
- if (totalSum >= giftPrice) {
- cout << "She is left with " << floor(totalSum - giftPrice) << " leva." << endl;
- }
- else {
- cout << "She will have to borrow " << ceil(giftPrice - totalSum) << " leva." << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement