+ 3
I can explain the logic of how I'd do it and you can convert it into C++ 1) make an array of Strings String arr = {"a", "b", "c"} 2) get a random generated num that goes from 0 to array.length-1 int random = (int) Math.random * array.length-1 3) print or return the value with function Print: cout>> arr[random] Method: public static String functionName() { String arr = {"a", "b", "c"}; Int rdm = (int) (Math.random() * arr.length); return arr[rdm] 4) call the function functionName(); I did it in java, its heavily commented so you should be able to convert to c++ https://code.sololearn.com/c8H9wqYt9CSk/?ref=app
18th Dec 2019, 1:54 AM
HNNX 🐿
HNNX 🐿 - avatar