If you're going to post C++, you need to have:
Code:
#include <iostream>
#include <ctime>
#include <cstdlib>

using namespace std;

int main() {
    srand(time(NULL)); //seeds the number
    int mynum = rand() % 100 + 1; //gets the random num
    cout << mynum << endl; //outputs it
}