#include <iostream>
#include <string>
using namespace std;
string determineTicketType(int age) {
if (age < 13) {
return "Child";
} else if (age >= 13 && age <= 64) {
return "Adult";
} else {
return "Senior";
}
}
double determineTicketPrice(const string& ticketType) {
if (ticketType == "Child" || ticketType == "Senior") {
return 10.0;
} else if (ticketType == "Adult") {
return 15.0;
} else {
return 0.0; // Invalid ticket type
}
}
int main() {
int age;
cout << "What is your age? ";
cin >> age;
string ticketType = determineTicketType(age);
double ticketPrice = determineTicketPrice(ticketType);
cout << "You will receive a " << ticketType << " ticket which will cost $" << ticketPrice;
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: