Random selection of a word

This is a discussion on Random selection of a word within the C Programming forums, part of the General Programming Boards category; I have to do a program (like hangman) which will need to randomly select a word from a file. I ...

  1. #1
    doobyscoo
    Guest

    Random selection of a word

    I have to do a program (like hangman) which will need to randomly select a word from a file.
    I have no idea of how to do this and is the only part of the program i cannot do.
    Any advice will be greatly recieved.

  2. #2
    eh ya hoser, got a beer? stumon's Avatar
    Join Date
    Feb 2003
    Posts
    323
    Create your file as a randomly access text file, then use the fseek() function with a randomly generated number to seek out a random bit location and get the word thats there. Pretty easy.
    The keyboard is the standard device used to cause computer errors!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Hangman game and strcmp
    By crazygopedder in forum C Programming
    Replies: 12
    Last Post: 11-23-2008, 05:13 PM
  2. Seg Fault in Compare Function
    By tytelizgal in forum C Programming
    Replies: 1
    Last Post: 10-25-2008, 03:06 PM
  3. seg fault at vectornew
    By tytelizgal in forum C Programming
    Replies: 2
    Last Post: 10-25-2008, 01:22 PM
  4. Replies: 16
    Last Post: 11-23-2007, 12:48 PM
  5. Random word problem
    By goron350 in forum C++ Programming
    Replies: 2
    Last Post: 05-14-2005, 03:44 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21