Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- string month;
- cin >> month;
- int hours, people;
- cin >> hours >> people;
- cin.ignore();
- string time;
- cin >> time;
- double price = 0;
- if (month == "march" || month == "april" || month =="may") {
- if (time == "day") {
- price = 10.50;
- hours = 3;
- } else {
- price = 8.40;
- }
- } else if (month == "june" || month == "july" || month == "august") {
- if (time == "day") {
- price = 12.60;
- } else {
- price = 10.20;
- }
- }
- if (people >= 4) {
- price *= 0.9;
- }
- if (hours >= 5) {
- price /= 2;
- }
- double total = price * people * hours;
- printf("Price per person for one hour: %.2f\n", price);
- printf("Total cost of the visit: %.2f\n", total);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement