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>
usingnamespace std;
int main()
{
srand(static_cast<unsignedint>(time(0)));
int randomnumber = rand () % 100 +1;
//lots of other stuff I don't believe is relevant to the question belongs here.