@rolfl has mentioned some great points, so I won't repeat those. I'll address some C++-specific things I've found, keeping in mind that Boost and C++11 shouldn't be mentioned.
These
usingstatements:using std::cout; using std::endl; using std::string;are okay to use, but I'd still use
std::where needed, especially if this list ends up getting longer. But this is still better than havingusing namespace std.Regarding the use of
char* []:For this:
int elements = sizeof(test_strings) / sizeof(test_strings[0]);elementsshould be of typestd::size_t, which is the return type of thesizeofoperator. You should also give it a more accurate name, such asnumberOfElements.Moreover, you shouldn't be needing to do this in C++ when you have access to the standard library. You can instead have an
std::vectorofstd::strings instead ofchar* [].ThisFor instance, this is what
test_stringswould look like:std::vector<std::string> test_strings = { /* string 1 */, /* string n */ };To get the size, just use
size():std::vector<std::string>::size_type elements = test_strings.size();This type should also be used when incrementing through the number of
elements.Instead of using
test_strings[0]to access the first element, you can usefront():test_strings.front();