I'm using a code segment out of a book that I'm learning from. For some reason it isn't working and I haven't been able to figure out how it works.

When I use the srand function it says I can't convert my (short) Number variable to a (void) srand (time(NULL)) there is an error.

- Error C2440: '=' : cannot convert from 'void' to 'short'
Expressions of type void cannot be converted to other types
-Warning C4244: 'argument' : conversion from 'time_t' to 'unsigned int', possible loss of data

#include <iostream>
#include <stdlib.h>
#include <time.h>
using namespace std;

main ()
	short Number, Guess = 0;

             Number = srand (time(NULL));

	while (Guess != Number)
		cout <<"Enter a number between 1 and 100: ";
		cin>> Guess;

	if (Guess < Number)
		cout <<"You are guessing to low." <<endl;

	if (Guess > Number)
		cout <<"You are guessing to high." <<endl;

cout <<"You got it bud, the winning number is: " <<Number <<endl;

return 0;

srand() only establishes the seed for the rand() function.

srand (time (0));
Number = rand ();