I'm studying the Accelerated C++ book
in the 7th chapter it teaches how to create random sentences from an input that goes like this
words between brackets work as categories
and <sentence> is the category that defines how the sentence will be organized
example:
I enter the lines:
<sentence> the <nounphrase> <verb> <location>
<nounphrase> <noun>
<nounphrase> <adj> <noun>
<adj> blue
<adj> red
<noun> table
<noun> chair
<verb> is
<verb> was
<verb> should be
<location> in the room
<location> outside
the output generated could be anything like:
the red table was outside
or
the chair should be in the room
but ... even doing everything the book asks me to I always get the same output sentence for the same input. I don't know why
could someone check it for me ? tell me if it happens to you to ? and why it's happening to me?
I would be very very grateful.
since it's kinda big I will post the code as a response.(just to make it more readable)