Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- string city; //"Bansko", "Borovets", "Varna" или "Burgas"
- cin >> city;
- string packet; //"noEquipment", "withEquipment", "noBreakfast" или "withBreakfast"
- cin >> packet;
- string vipDiscount;
- cin >> vipDiscount;
- int days;
- cin >> days;
- //проверка за дните
- if (days < 1)
- {
- cout << "Days must be positive number!";
- return 0;
- }
- double pricePerDay = 0;
- if (city == "Borovets" || city == "Bansko")
- {
- //първоначална цена за 1 ден
- if (packet == "withEquipment")
- {
- pricePerDay = 100;
- if (vipDiscount == "yes")
- {
- //10% отстъпка
- pricePerDay = 90;
- }
- }
- else if (packet == "noEquipment")
- {
- pricePerDay = 80;
- if (vipDiscount == "yes")
- {
- //80 - 5% остъпка = 76
- pricePerDay = 76;
- }
- }
- else
- {
- cout << "Invalid input!";
- return 0;
- }
- }
- else if (city == "Burgas" || city == "Varna")
- {
- if (packet == "withBreakfast")
- {
- pricePerDay = 130;
- if (vipDiscount == "yes")
- {
- pricePerDay = 114.40;
- //pricePerDay = 130 - 0.12 * 120;
- }
- }
- else if (packet == "noBreakfast")
- {
- pricePerDay = 100;
- if (vipDiscount == "yes")
- {
- pricePerDay = 93;
- //pricePerDay = pricePerDay - 0.07 * pricePerDay;
- }
- }
- else
- {
- cout << "Invalid input!";
- return 0;
- }
- }
- else
- {
- cout << "Invalid input!";
- return 0;
- }
- //знаем колко е цената за един ден
- //обща цена за почивката = брой на дните * цена за 1 ден
- //над 7 дни -> 1 ден безплатен
- if (days > 7)
- {
- days -= 1;
- }
- double totalTripPrice = days * pricePerDay;
- cout.setf(ios::fixed);
- cout.precision(2);
- cout << "The price is " << totalTripPrice << "lv! Have a nice time!";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement