You need to use srand() to seed rand before you use it. For a game like yours i would use srand((unsigned)time(0)); . You will need to use #include <ctime> in your code to do this.
NathanOliver
Posting Virtuoso
1,515 posts since Apr 2009
Reputation Points: 281
Solved Threads: 277
Skill Endorsements: 3
Doen't your book explain it? Or your tutorial site? What about Google?
WaltP
Posting Sage w/ dash of thyme
11,404 posts since May 2006
Reputation Points: 3,421
Solved Threads: 1,055
Skill Endorsements: 37
Question Answered as of 3 Years Ago by
WaltP
and
NathanOliver i am making hangman game and i want the program to pick up random wrds... how can i do it???
I haven't done anything similar to it, but you'd need database which contains words.
And you'll need some "Input/Output with files" skills to get words from database ( for example some *.txt file which contains words, unless you are going to make a huge code by writing all words in a code...within some struct... sounds bad idea ).
MrEARTHSHAcKER
Junior Poster in Training
77 posts since Sep 2011
Reputation Points: 10
Solved Threads: 1
Skill Endorsements: 0