Hey so I'm still learning in programming, and I was wondering how to apply fstream when reading and writing to a file. For example, say I have the following content in a file named words.txt:
"these are words"
Right now I just need to be able to ask a user which number word they want, and then display it. I don't want any whole coding, just a general idea on how to do this.
Stream is continuous, so You must think about search algorithm (in google there is a lot). You can change the position of cursor in stream to the end of file I think but I don't know exactly.
A way could be storing words from the file in a vector and then display the wanted elements of the vector,
another way could be looping through files characters and looking for spaces which divide the words
Haha thanks but I guess I should correct myself, I do want a bit of code, but to help me understand how to apply fstream. For example taking the three words and putting them in as separate entries in an array?