The C++ standard library provides the class std::string
, which you should opt for as opposed to char*
, char[]
, and that C-ish, unsafe stuff.
You then read into these strings (in your case) from the std::cin
input stream using either std::istream::operator>>
or std::getline
or whatever you want to use, depending on what you want to read.
Now, to store these strings in a suitable data structure, something array-ish seems fit. The C++ standard library offers various kinds of containers for this, solely depending on how you want to store/access the strings. Examples are std::vector
(dynamically modifiable array), std::array
(safer alternative to an array), std::deque
(double-ended queue), std::forward_list
(singly-linked list), and std::list
(doubly-linked list). These data structures provide appropriate operations to append items, remove them, insert them, etc. depending on the particular container how efficient they are and if they're implemented at all.
For general-purpose tasks, I recommend std::vector
.