Proper commands for making games

I've been surfing around the internet and these forums and from what I've seen using cout/cin is not considered the "right" way to code. I've seen multiple answers on how to do this so I'm hoping for some clarity.

I'm trying to make a small text based RPG, so would it be ok to stick with cout/cin or should I do something else.

I just want to make sure that I learn to code the right way so I don't have to break bad habits later on.

Thanks!
cin and cout are not appropriate if you're writing a graphics based program.

cin and cout are certainly appropriate for a text based RPG.
I've been surfing around the internet and these forums and from what I've seen using cout/cin is not considered the "right" way to code


What do you mean? Where on this forum has someone said "Don't use cin/cout"? What else would you use?

AbstractionAnon is correct though, if you are making a game (or some other windowing program), then cin/cout simply won't work. But that has nothing to do with the "right" way to code.
Whoever told you that cin/cout wasn't the right way to code should be shot, even in a GUI game you can have your compiler run a terminal window on a debug executable, and then use cout to easily display messages that may help you debug.
cin and cout is great because they are standard and works on every C++ compiler you use.

cout outputs text in a linear fashion, there is no way to go back and change what was previously outputted. It's not possible to have coloured text (in a standard way that works everywhere).

cin reads input from the user. The input is often line buffered so the program doesn't receive input until the user press enter. If there is nothing to read cin will wait until there is something to read or EOF is reached.

You can use cout and cin to make simple games but be aware of the limitations they put on your game. If you want to be able to do more you should look into some kind of library to do so.
Topic archived. No new replies allowed.