Generating Random Numbers in C++

#include <iostream.h> // for cout
#include <stdlib.h>   // for rand()

void main(void)
{
  for (int x = 0; x < 5; x++)
    cout << rand() << endl;
}

Output:
346
130
10982
1090
17595
Next page

Back to Lesson 12 Index
Back to Outline