vendredi 2 octobre 2015

Random and Randomize Function

How does random and randomize functions work? Please help me!

#include<iostream.h>
#include<stdlib.h>
const int LOW = 15;
void main()
{     randomize();
      int POINT=10, Number;
      for(int I=1; I<=4; I++)
      {      Number = LOW + random(POINT);
             cout<<Number<<":";
             POINT--;
      }
}

What are the different outputs that can be predicted from this program? And How? Explain. I have got four options for this code 1) 24:23:22:21: 2) 24:25:23:21 3) 21:22:23:24 4) 22:23:21:24
And I haven't got any of these output, there must be a basic format or something to solve these types of programs. Please help. I have also referred to Books telling about these type of programs but I can't understand the working of these type of programs.




Aucun commentaire:

Enregistrer un commentaire