ticket office problem
MY CODE IS NOT WORKING FOR TEST CASE 4 ONLY You are working on a ticketing system. A ticket costs $10. The office is running a discount campaign: each group of 5 people is getting a discount, which is determined by the age of the youngest person in the group. You need to create a program that takes the ages of all 5 people as input and outputs the total price of the tickets. Sample Input: 55 28 15 38 63 Sample Output: 42.5 The youngest age is 15, so the group gets a 15% discount from the total price, which is $50 - 15% = $42.5 The given code is declaring an array of 5 elements and taking them from input using a loop. #include <iostream> using namespace std; int main() { int ages[5]; for (int i = 0; i < 5; ++i) { cin >> ages[i]; } int e =0; double total=50.0; int u=0; for (int y =0; y < 5; y++){ if (ages[0] < ages[u] && ages[0] <= ages[0]){ e =ages[0]; } else if (ages[1] < ages[u] && ages[1] <= ages[0]){ e =ages[1]; } else if (ages[2] < ages[u] && ages[2] <= ages[0]){ e =ages[2]; } else if (ages[3] < ages[u] && ages[3] <= ages[0]){ e =ages[3]; } else if (ages[4] < ages[u] && ages[4] <= ages[0]){ e =ages[4]; } else{ e=ages[y]; } u++; } double t= e*total/100; double r = 50 - t; cout<<r; return 0; }