what is missing from my code ? 😓 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

what is missing from my code ? 😓

https://code.sololearn.com/cp5PApJgXOoW/?ref=app

5th May 2019, 9:48 AM
El Patriarcado
El Patriarcado - avatar
3 Answers
+ 6
https://code.sololearn.com/cbIZ2XwM92GO/?ref=app
5th May 2019, 10:00 AM
Rstar
Rstar - avatar
+ 6
The random number is generated outside of the loop, so it will print the same character each time. Change it like this to generate a new character each loop: for ( int i=0 ; i<=N-1 ; i++ ) { alea = rand()%( 52-1 +1 ) +1 ; cout << caract[alea] ; }
5th May 2019, 9:57 AM
Anna
Anna - avatar
+ 3
thank you Rstar and Anna 🙂
5th May 2019, 10:05 AM
El Patriarcado
El Patriarcado - avatar