+ 2

C++ ticket office doesn't work

Hi, i don't know, what is wrong All Tests does work except the last test, but it is hidden. Can someone tell me, what ist wrong? My code ist below. Thank you! #include <iostream> using namespace std; int main() { int ages[5]; for (int i = 0; i < 5; ++i) { cin >> ages[i]; } //ouble ages[0]; //your code goes here for(int x=1;x<4;++x){ if(ages[0]>=ages[x]){ ages[0]=ages[x]; } } float price=50; float total=50-50*ages[0]/100; cout<<total; return 0; }

22nd Sep 2022, 9:09 AM
G duck
G duck - avatar
2 Respuestas
+ 3
Gülistan Uca There are 5 items in array ages so 2nd loop will be x < 5 and do 100.0
22nd Sep 2022, 9:16 AM
A͢J
A͢J - avatar
0
Thank you!!! Now it works 😀
22nd Sep 2022, 10:10 AM
G duck
G duck - avatar