943,929 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 4562
  • C++ RSS
Aug 12th, 2004
0

Selecting random word from file (C++)

Expand Post »
I've created a file called country.txt which holds a list of 100 countries' name. Eg (to name a few):

America
Bahamas
Canada
Denmark
Eygpt
France
Germany
Hong Kong

My question is, how would I have the computer pick a random country name from the list above? Do I have to put a number at the front like below and use the random number generator? (if yes, can someone guide me on how to write in out in C++ format?)

1America
2Bahamas
3Canada
4Denmark
5Eygpt
6France
7Germany
8Hong Kong


Thank you!
Similar Threads
Reputation Points: 11
Solved Threads: 0
Newbie Poster
Pikachu is offline Offline
19 posts
since Aug 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
This thread is currently closed and is not accepting any new replies.
Previous Thread in C++ Forum Timeline: How Do I Repeat The Programm Without Go Back To Windows?
Next Thread in C++ Forum Timeline: pointer to member?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC