Register Quiz
#9

pawn Код:
enum quiz {
    question[64],
    correctAnswer[64],
    wrongAnswer1[64],
    wrongAnswer2[64],
    wrongAnswer3[64],
};

new quizQuestions[][quiz] = {
   {"How many apples?", "10", "5", "15", "20"},
   // etc.
};
pawn Код:
new SelectedQuestions[20] = {-1, ...}, rand;

for(new i; i < sizeof(SelectedQuestions); i++)
{
    do rand = random(sizeof(quizQuestions));
    while(inArray(rand, SelectedQuestions));

    SelectedQuestions[i] = rand;
}
pawn Код:
stock inArray(value, const array[], size = sizeof(array))
{
    for(new i; i < size; i++)
        if(array[i] == value) return true;

    return false;
}
There's much more to it, but this should give you an idea.
Reply


Messages In This Thread
Register Quiz - by antonio112 - 22.09.2012, 04:53
Re: Register Quiz - by JhnzRep - 22.09.2012, 04:56
Re: Register Quiz - by antonio112 - 22.09.2012, 05:24
Re: Register Quiz - by JhnzRep - 22.09.2012, 05:47
Re: Register Quiz - by antonio112 - 22.09.2012, 05:56
Re: Register Quiz - by JhnzRep - 22.09.2012, 06:07
Re: Register Quiz - by antonio112 - 22.09.2012, 06:43
Re: Register Quiz - by antonio112 - 22.09.2012, 17:00
Re: Register Quiz - by Vince - 22.09.2012, 17:32
Re: Register Quiz - by antonio112 - 12.10.2012, 21:20

Forum Jump:


Users browsing this thread: 2 Guest(s)