0

ticket office

Hi, I solved ticket office project code (related to Data Types, Arrays, Pointers) but it doesn't approve me while the answers are as expected, could you please have a look at code below: #include <iostream> #include <algorithm> using namespace std; int main() { int ages[5]; for (int i = 0; i < 5; ++i) { cin >> ages[i]; } //your code goes here int &min = *min_element(ages, ages+5); cout << "youngest person age is: " << min << endl; float totalPris = 50; float discount = (totalPris*min)/100; cout << "discount: " << discount << endl; totalPris = (totalPris - discount); cout << "total price for your group is: " << totalPris << endl; return 0; }

22nd Nov 2021, 9:14 AM
Elnaz Ekramian
3 Respuestas
+ 4
Elnaz Ekramian , as Rik Wittkopp already mentioned, you should remove all unnecessary output of messeges. this is due to the software that checks the code and runs the test cases. beside of this, there is an issue with the output of the result. giving an input of: 11, 18, 19, 22, 49 (each on a separate line) the output will be: 11, 55, 44.5 (each on a separate line) but should be: 44.5 this is the same for all open testcases.
22nd Nov 2021, 10:01 AM
Lothar
Lothar - avatar
+ 2
Elnaz Ekramian Your output must exactly match the expected requirement of the challenge. I haven't looked at that challenge for a while, but I don't remember all those sentences being required. I think the challenge ONLY requires the discount
22nd Nov 2021, 9:28 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 2
Lothar Nice pick up
22nd Nov 2021, 10:06 AM
Rik Wittkopp
Rik Wittkopp - avatar