I don't understand this code. can anyone please explain me these codes individually ? and I dont what what the seed value is in random number generator ?
Computers work because of logic gates, because of this they cannot produce random numbers. The way proggrammers work around this is through Pseudorandom number generator (http://en.wikipedia.org/wiki/Linear_congruential_generator). Based on a given number this will generate a seeming random number between 0 and RANDMAX. This given number is called a seed. srand will set a seed for the random numbers. (unsigned)time(NULL) just makes 'the time' a seed so that you get varied results every time you run the program. To get a random number after seeding it with srand, use int randomNumber = rand() % 10
to generate a number between 0 and 9