Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- double amount;
- cin >> amount;
- int puzzles, dolls, bears, minions, trucks;
- cin >> puzzles >> dolls >> bears >> minions >> trucks;
- double puzzlePrice = puzzles * 2.6;
- double dollsPrice = dolls * 3;
- double bearsPrice = bears * 4.1;
- double minionsPrice = minions * 8.2;
- double trucksPrice = trucks * 2;
- int toys = puzzles + dolls + bears + minions + trucks;
- double price = puzzlePrice + dollsPrice + bearsPrice + minionsPrice + trucksPrice;
- if (toys >= 50) {
- price *= 0.75;
- }
- price *= 0.9;
- cout.setf(ios::fixed);
- cout.precision(2);
- if (price >= amount) {
- cout << "Yes! " << price - amount << " lv left." << endl;
- }
- else {
- cout << "Not enough money! " << amount - price << " lv needed." << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement