I create a text game using C ++ for a school project, the game works, allowing the user to choose from a list of options in each scene; similar to how the games conducted by "Game Selection" work . As a result of this, I have a large amount of text that should be displayed in my game, however, I am not sure about the correct agreements when working with a large amount of text in the program. Should I just use std :: cout and write the text directly to the code, or do I need to write to the text files used by std :: ifstream to read the text.
My only serious problem with using files to store text is that each user choice produces results in a different paragraph that appears, and as a result, I believe that I will need to create a text file for each paragraph that looks like that this will lead to more problems (for example, using the wrong file name or typo of my code leading to reading the game from the wrong file) than writing text directly to the code. If there is a way to read certain sections of a text file, then it would be useful to know, however, I currently do not know about any such method. However, I am new to C ++, and I’m sure that I still have to learn, so I won’t be surprised if such a method existed.
Any help is appreciated, whether just telling me whether I should enter text in my code or in files to tell me if there is a way to read text from specific sections of a text file. And again, I am very grateful for any help you can provide.
source share