int main ()
{
srand ( time(NULL) ); //initialize the random seed
const char arrayNum[4] = {'1', '3', '7', '9'};
int RandIndex = rand() % 4; //generates a random number between 0 and 3
cout << arrayNum[RandIndex];
}
What this code does, is that it randomly genrate a number from arrayNum[4], what i want to know is this:
Instead of 1,3,7,9. where then the randindex obtain one number from the const char array[4] i want strings, basically words like "cake", or "toast"
Is there anyway to do this, is there anyway to write a program that randomly generate strings instead of just of vaules.
A sample code will be nice, along with some explaination
Never thought it was this simple, thought you had to at least use class or something. (probably cause i had the wrong idea or didn't read too carefully)
"If you are asking about how to generate random sentences, that's a masters thesis right there. Good luck to you with that."