How Can I Generate a Random Number

In the code below is shown how to generate a random number in C++:

The output of this program is shown below:

output