+ 1

Problem with arrays in c++

Hi how can I divide by a number the all list of an array ?

26th Oct 2019, 10:00 AM
Alessandro Barattiero
4 Réponses
+ 6
You can use a loop and divide each element by the number.
26th Oct 2019, 10:09 AM
Sonic
Sonic - avatar
+ 4
You will need to think about whether you want to create a new array or modify the existing one.
26th Oct 2019, 10:10 AM
Sonic
Sonic - avatar
0
can you write me the code please? i haven’t understood
26th Oct 2019, 10:14 AM
Alessandro Barattiero
0
for(i : list) list[i] /= 2
26th Oct 2019, 10:24 AM
Joris
Joris - avatar