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; }
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
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