+ 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; }
2 Réponses
+ 3
Gülistan Uca
There are 5 items in array ages so
2nd loop will be x < 5
and do 100.0
0
Thank you!!! Now it works 😀