please tell me How use to random

We have a project. Our program is a quiz show. It is a who wants to be millionaire type of program. I really need to know how to use randow cause I need to ramdom the questions. Need it badly.

additonal:

Also can anybody tell me how will able to let input the name of the player,
cause when I use char, the only thing that appears is the first initial.

plus

can anybody give me a site where there is c++ tricks and techniques??

_______________________________________________________

if you know any, please tell me.
Last edited on
Hi!
Include this files:
1
2
#include <ctime>
#include <cstdlib> 


To init the random numbers:
srand( (unsigned) time(0) );

And to use random number you can use this:
rand()%max

But I recommend that you make a function for it, something like this:
1
2
3
4
inline double random(double start, double end)
{
    return start+(end-start)*rand()/(RAND_MAX + 1.0);
}


//Dosshell
Last edited on
Dosshell..
thank you so much for replying...

The thing is I need to random questions.
I am creating a multiple choice quiz show,,
Our prof told us we need to random the questions..

Topic archived. No new replies allowed.