Storing Users Input

This is a discussion on Storing Users Input within the C++ Programming forums, part of the General Programming Boards category; Hello, I am quite new to C++ and I was wondering how to store a users input. I am thinking ...

Storing Users Input

Hello, I am quite new to C++ and I was wondering how to store a users input. I am thinking that I would use a string. I don't think I would use a string or a structure, unless their is a away to store input from a user into a structure. I am making a text based game right now, and I was wondering how to store users data. Ex. If I ask the user "how many cavalry units do you want?", I want to know how to store that data. THANKS.

With a structure, you can keep all of your data organized. This is especially true if...

- Some of the variables in the structure can be integers, some floats, and some strings.

- There are multiple users, and you need to store the same set of data for each user. With a structure, you can allow for any number of users, without knowing (when you write the program) how many users there will be.

You will generally get one variable from the user at a time, and fill-in the structure as you go.

Later when you learn about classes and objects you can "upgrade" the structure to a class (which is something like a smart structure).