Question: I am creating a text based game using C++ for a school project, the game works by allowing the user to pick a choice from a list of options in each scene; similar to how the games hosted by [Choice of Games](https://www.choiceofgames.com/category/our-games/) work. As a result of this I have a large amount of text that must be displayed in my game, however I am unsure as to the proper conventions when working with large amounts text in a program. Should I simply make use of **std::cout** and write the text directly into the code, or should I write into text files an used **std::ifstream** in order to read the text.

My only major concern regarding the use of files to hold the text is that each choice the user makes results in a different paragraph being displayed and as a result I believe that I would need to create a text file for each paragraph, which seems like it will lead to more issues (such as using the wrong file name or mistyping my code leading to the game reading from the wrong file) than writing the text straight into the code could. If there is a way to read particular sections of a text file then this would be useful to know, however I am currently unaware of any such method. However I am new to C++ and I am certain that there is plenty that I have yet to learn so I would not be surprised if such a method did exist.

Any help is greatly appreciated, be it anything from simply telling me if I should enter text into my code or into files, to telling me if there is a way to read text from specific sections of a text file. And once again, I am very grateful for any help you can provide.

Answer: 
Please don't put displayed text into code. That's an antipattern. You have to recompile your game for every minor text change like fixing typos, and for major changes like translating into other languages. 

Convention for most programming languages is to put all the displayed text into (a few) resource files or properties files as key-value pairs, where the code only references the key of the paragraph to be displayed and the value will be loaded from that external file. (Usually once during startup.) No need to use one file per paragraph, but the kv pairs have to be parsed. There'll be utilities for you to reuse.
If you do not plan to translate you game to other languages, you are on your own, both approaches have their pros and cons:

* text in source: easy to write, text is near the place where it is used.
* text in resource files: easier to remove duplicate strings, forces a better structure of text data.

If you simply imagine that your application could be translated, then you should put all text in ressource files. You can even find framework that will assist your for translations as [Gnu gettext](http://www.gnu.org/software/gettext/), but you can find others, for example [qt](http://www.qt.io/) has its own translation tools.