Randomzzz

I need a program to generate random numbrs between 65 and 90 how cn i du tht?
Step 1:
Include <cstdlib> & <ctime> if you are using a new compiler, if not <stdlib.h> & <time.h>

Step 2:
At the beginning of main () add
srand(time(0));

Step 3:
Create a variable (in the example, Examp) to hold the number.

Step 4:
Set the value of the variable as:
Examp = Minimum + rand()% ( Maximum - Minimum )
where Maximum and Minimum are the ranges for your random number.
Topic archived. No new replies allowed.