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;
- string season;
- cin >> season;
- string place = "Hotel";
- string region = "Europe";
- double budgetPercertagePrice = 0.9;
- if (budget <= 100) {
- region = "Bulgaria";
- if (season == "summer") {
- place = "Camp";
- }
- budgetPercertagePrice = season == "summer" ? 0.3 : 0.7;
- }
- else if (budget > 100 && budget <= 1000) {
- region = "Balkans";
- if (season == "summer") {
- place = "Camp";
- }
- budgetPercertagePrice = season == "summer" ? 0.4 : 0.8;
- }
- cout.setf(ios::fixed);
- cout.precision(2);
- cout << "Somewhere in " << region << endl;
- cout << place << " - " << budget * budgetPercertagePrice << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement