String Radomization

I am trying to randomize an array of strings.
ex(like in a mad lib program)

I have them declared as

// CODE
string callType[3] = { "Beginner", "Intermediate", "Advanced" };
// END

What is the syntax for randomizing an array so it will randomly choose between those three using the rand fucntion?

ANY HELP?

rand()%n returns a random integer between 0 and n
ok so you are saying that i cant use it with the array of strings?

if thats true then how would i randomize those strings
array[n] returns the (n-1)th element of the array...
i'm still new to this language so you are really not helping me by what you are saying, and i know the return values
if you are not going to answer my question then don't bother posting on here because you are absolutely no help

thanks
If rand()%n returns a value from 0 to n-1 and an array with n elements gets for subscripting (brackets) a value from 0 to n-1 what does this suggest you?
alright i get what you are saying, but not fully. its the syntax that is throwing me for a loop so to speak.

Try coding a bit, if you don't get anything working post your code and I'll show what you should modify
how about this

string name[10] = {"Eric", "Tim", "Timmy's Man Friend Steven", "Jermiah", "Jason", "Chris", "Don", "Cheryl", "Blake", "Trevor"};

_name = name[rand() % (10)];

it works for me. does it look good
Yes, it's right.

You don't need parentheses around 10


when posting code use the [code][/code] tags so it looks better

Topic archived. No new replies allowed.