Why is my code not working?
For my code project, I am suppose to create a program that takes the ages of all 5 people as input, and outputs the total price of the tickets. A ticket costs $10 for 5 people (5*10=50). For example: Sample Input: 55 28 15 38 63 Sample Output: 42.5 So I would have to find the youngest age of the 5 people, and use it as their discount. So for this example, $50-15%=$42.5 Here is the code that I wrote: #include <iostream> #include <iomanip> using namespace std; int main() { int ages[5]; for (int i = 0; i < 5; ++i) { cin >> ages[i]; } //your code goes here int ticket = 10; double totalTicket = ticket * 5; double min = ages[0]; double total; for (int i = 0; i < 5; i++) { if (ages[i] < min) { min = ages[i]; } total -= totalTicket * min / 100 - totalTicket; cout << total << min; } return 0; } Can someone explain to me why it is not working?