- 1

C++ x *= 0.array[ y] why not working?

5th Jul 2022, 3:37 PM
Nick Gamer
Nick Gamer - avatar
3 odpowiedzi
0
Nick Gamer Incomplete code.. Provide full code.
5th Jul 2022, 3:57 PM
A͢J
A͢J - avatar
0
int ages[5]; for (int i = 0; i < 5; ++i) { cin >> ages[i]; } //your code goes here double nums = 50; for(int b = 0; b<5;b++){ nums -= 0.ages[b]; } cout << nums;
5th Jul 2022, 3:59 PM
Nick Gamer
Nick Gamer - avatar
0
Nick Gamer 0.ages[b] is not a right syntax You have to get minimum value from that array ages. To get minimum value you can store first value in a variable and then compare this value with next value of that array. And after getting minimum value calculated discounted amount like 50 - 50 * minimum_age / 100;
5th Jul 2022, 4:05 PM
A͢J
A͢J - avatar