0

help me in c++

https://www.sololearn.com/discuss/2733266/?ref=app this is my code... question in link #include <iostream> using namespace std; int main() { int ages[5]; int min=ages[0]; int cost=10; int total; for (int i = 0; i < 5; ++i) { cin >> ages[i]; } //your code goes here total=cost*5; cout<<total-total*min/100; return 0; }

23rd Mar 2021, 7:55 PM
Syed Sufian
Syed Sufian - avatar
2 Answers
+ 1
age [0] is not the smallest number in the array, but the first number entered in it. For age [0] to be the smallest number you must then order the array, you can use for example the bubble method so that the array is ordered from smallest to largest
24th Mar 2021, 4:22 AM
Julio Amaro
Julio Amaro - avatar
0
You can ask there in your original post. Why another one? It may marked as duplicate. You must find min from 5 inputs. That's missing.... Not always ages[0] may small. So find min from 5 inputs into 'min' . And take 100.0 instead of 100
23rd Mar 2021, 8:03 PM
Jayakrishna 🇼🇳