Hi,
Got another question concerning an array of strings:
I did it this way:
int main()
{
const std::string myArray[] = { "January", "February", "March", "April", "May", "June", "July",
"August", "September", "October", "November", "December"};
for (size_t i = 0; i < 12; i++)
std::cout << myArray[i] << '\n';
std::cout << '\n';
std::cin.get();
return 0;
}
but I thought that there was also a way that you could use the beginning and end of the array to loop threw the array like this myArray.begin() and myArray.end()
doing something like this:
std::string::iterator itr;
for (itr = myArray.begin(); itr != myArray.end(); itr++)
std::cout << *itr << '\n';
std::cout << '\n';
Problem I have is that I'm using an array of strings, I therefore used the following myArray[0].begin() and myArray[11].end()
but that doesn't seem to work.
Could anyone help me out, thank you.