I Have A Question | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

I Have A Question

How Could You Make A Random Word Generator In C++?,Because I Know rand() Function Prints Random Number,But Something That I Wanna Know Is How You Make A Random (Word) Generator In C++?,Like I Want To Insert Some Word,And Needs The Program To Output One Of Those Word

10th Dec 2021, 6:04 AM
Lidya Reine
Lidya Reine - avatar
3 Answers
+ 6
If you have a list of words in some array or container, you can generate a random value that lies within the arrray/container lower and upper bounds. You can then use the random value as index to obtain a random element from the array/container. Didn't understand what you mean by this line ... "I want to insert some word, and need the program to output one of those words."
10th Dec 2021, 6:18 AM
Ipang
+ 4
It's okay, you can use translator programs to overcome language barrier. Try to explain what you are trying to do first. Technical details comes later.
10th Dec 2021, 6:34 AM
Ipang
+ 3
Sorry,I Have A Bad English :(
10th Dec 2021, 6:26 AM
Lidya Reine
Lidya Reine - avatar