Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- double budget;
- cin >> budget;
- double needLiters;
- cin >> needLiters;
- string dayOfWeek; //"Saturday" и "Sunday"
- cin >> dayOfWeek; //въвеждане на текст без интервали
- //цена за сафари = цена гориво + цена за екскурзовод (100)
- double safariPrice = (needLiters * 2.10) + 100;
- //отстъпки
- //20% от цената ако е неделя
- if (dayOfWeek == "Sunday")
- {
- safariPrice = safariPrice - 0.2 * safariPrice;
- //safariPrice = 0.8 * safariPrice;
- //safariPrice *= 0.8;
- }
- //10% от цената ако е събота
- else if (dayOfWeek == "Saturday")
- {
- safariPrice = safariPrice - 0.10 * safariPrice;
- //safariPrice = 0.9 * safariPrice;
- //safariPrice *= 0.9;
- }
- cout.setf(ios::fixed);
- cout.precision(2);
- //крайна цена за сафарито
- //бюджетът е достатъчен
- if (budget >= safariPrice)
- {
- cout << "Safari time! Money left: " << budget - safariPrice << " lv. ";
- }
- else //budget < safariPrice
- {
- //бюджетът не е достатъчен
- cout << "Not enough money! Money needed: " << safariPrice - budget << " lv.";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement