vendredi 24 avril 2015

How to generate random number in c++

    #include<iostream>
    using namespace std;
    #include<stdlib.h>
    int main()
    {
      cout<<rand();
    }

When I run this program , it generates random number like its 41. And when I again run the program, it generates the same number i.e. 41. But I want to generate different random number all the time when we run the program. So, please tell me, how it can be done?




Aucun commentaire:

Enregistrer un commentaire