Answer to Question #40191 in C++ for weber

Question #40191
Suppose you are organizing an event and you want to sell the tickets based on the following scheme: Age: Ticket Price: Below 8 years: AED 5 Between 8 and 16: AED 10 Between 17 and 50: AED 20 Above 50: AED 15 Create a program that asks the user for his/her age and outputs the cost of the ticket. Your program should repeat this as long as the user wants.
Expert's answer
//Answer on Question#40191, Programming, C++
#include <iostream>

using namespace std;

int main()
int age;
while (true)
cout << "Enter your age : ";
cin >> age;
if (age < 0)
cout << "Wrong input" << endl;
else if (age < 8)
cout << "Ticket will cost 5 AED" << endl;
else if (age <= 16)
cout << "Ticket will cost 10 AED" << endl;
else if (age <= 50)
cout << "Ticket will cost 20 AED" << endl;
cout << "Ticket will cost 15 AED" << endl;
cout << endl;
return 0;

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

New on Blog