0

How to fill an array automaticly with "#" and " "?

Hello, is it possible to fill an char or string array automaticly with "#" an " " alternately? Can somebody explain me how i can fill it? It would be also helpfull if someone can explain me even how to fill an array only with "#".

7th Sep 2019, 9:03 PM
Peter Möhle
Peter Möhle - avatar
4 Antworten
+ 2
for (0...array.size){ if(random.boolean()) array[i] = " "; else array[i] = " #"; } It is just algorithm, translate to your programming language
7th Sep 2019, 10:43 PM
Marina Vasilyova
Marina Vasilyova - avatar
+ 1
Peter Möhle any attempts to translate?
8th Sep 2019, 10:04 PM
Marina Vasilyova
Marina Vasilyova - avatar
0
use a for loop to go through the array and assign every index
7th Sep 2019, 9:08 PM
Anton Böhler
Anton Böhler - avatar
0
Can somebody transform Maria Vasilyova's code in c#? I cant do it
8th Sep 2019, 12:02 PM
Peter Möhle
Peter Möhle - avatar