How to print random words in C?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • deneme birki
    New Member
    • Dec 2010
    • 1

    #1

    How to print random words in C?

    hello.
    i want to print one of random words that i defined before, on screen. but using an external .txt or .dat file.
    for example i add 100 words on the words.txt or words.dat file and program will print one of them randomly on screen.
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    Load the words into an array.

    Calculate a random number between 0 and the length of the array.

    Use that random number to retrieve a word from the array.

    This will give you a random word.

    -Frinny

    Comment

    Working...