Ask user for seed?

This code uses the date and time as a seed. I'd like to know how to ask the user for a random seed. I thought it'd be as simple as replacing (time(0)) with and unsigned variable 'seed' and before generating the number, ask the user to give a seed with cin >> seed. But that didn't work. Can it be done by modifying this, or is there some much more complicated code involved, because if there is, I barely understand this right now and more complicated is the last thing I need.

1
2
3
4
5
6
7
8
9
10
11
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;

int main()
{
	srand(static_cast<unsigned int>(time(0)));
	int randomnumber = rand () % 100 +1;

//lots of other stuff I don't believe is relevant to the question belongs here. 
before generating the number, ask the user to give a seed with cin >> seed

that should be,
Before calling srand(seed), ask the user to give a seed with cin >> seed.
Ahh! That works, thanks a bundle.
Topic archived. No new replies allowed.