0
Ticket Office-c++
This is the quest: 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. My code here: https://code.sololearn.com/cdAMzVK0Na81. All works, expect of the fifth hidden quest, can someone explain me why? Nothin is missing, so what's the problem?
4 ответов
+ 1
Of course, becouse if theless = age[0] and the condition isn't true, it doesn't remain theless, but became the value of ages[0], so I have to sai to the loop that if the condition isn't true, the less has to remain the less. I have to think bout' this. Thanks for the hint
+ 1
Then i chaned it--> https://code.sololearn.com/cdAMzVK0Na81.
But the fifth quest still not works. I can't thinking why. If I try all the possible type of values order, it still works expect if the last values is the less.
+ 1
Ok, the problem was in the loop, now it works, the loop has to be <=4, course when he arrives at age[4] he stopped course 4<4 isn't true.
0
I edited it, trying to check if the whole array was equal to zero, but nothing has changed.