question about Ticket office test, C++
this is my first post here. so i can't say if this is the correct format. i made this post because i was wondering if there were better ways of doing this test, then how i completed it, because i wasn't really satisfied with how i did it. and also because i couldn't really see any way to implement any of the stuff beyond what was taught in the basic modules. test "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" #include <iostream> using namespace std; int main() { int ages[5]; for (int i = 0; i < 5; ++i) { cin >> ages[i]; } //insert your code here int min; float discount = 150; for(int a = 0; a < 5; ++a) { min = ages[a]; if (min < discount) { discount = min; } } float price = 50 - 50 * (discount * 0.01); cout << price << endl; //end of your code return 0; }