| | |
Selecting random word from file (C++)
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
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!
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
- help! generate random word function from fiveLetter.txt file (Python)
- File I/O (Reading from a Random-Access File) NEW (C++)
- get a random word (C++)
Other Threads in the C++ Forum
- Previous Thread: How Do I Repeat The Programm Without Go Back To Windows?
- Next Thread: pointer to member?
| Thread Tools | Search this Thread |
api array based beginner bitmap c++ c/c++ calculator char class classes code coding compile compiler console conversion count database delete deploy desktop developer directshow dll download dynamic email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory multiple news node number output parameter pointer problem program programming project python random read recursion recursive return sorting string strings struct temperature template templates test text text-file tree unix url variable vector video visualstudio win32 windows winsock word wordfrequency wxwidgets




