You would use rand. Just say you have a data base of questions, maybe held by an array. On the event that pulls up questions, it would do something like this.
- Code: Select all
int randomQ = rand(2);
switch(randomQ)
{
case 0:
strcpy(textActor.text, "Question number one is?");
break;
case 1:
strcpy(textActor.text, "Does this make sense?");
break;
}
It may differ, but this is the general idea. So you know, rand picks a random number from zero to the int one less than the number, so in this case 0 or 1. Since it can be only two possibilities, I have two cases in the switch statement, but you would have more, one for each question.