# C++ Course 3 Topic, Data Types, Arrays, Pointers, Practice

Good Evening programmers At now i am trying to resolve the final practice exerscice, but i´m having problems with it, the problem says the following : "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 I am going to show my code for the problem : #include <iostream> #include <iomanip> using namespace std; int main() { int ages[5]; float sum ; int aux, x; for (int i = 0; i < 5; i ++) { cin >> ages[i]; if( ages[i] > ages[i-1] && i >= 1) { aux = ages[i]; ages[i] = ages [i-1]; ages[i-1] = aux; x = i; } } cout << ages[x]; sum = 50 - (50 * (ages[x] / 100.0)); cout<<"The total price is equal to " << sum << endl; return 0; } In fact it works for the four first test , but it is failing with the five and ultimate text (and i can´t the inputs, cause i am not premium, i only want to see the result in all test is correct). Can you help me ? , i am glad for this.