I recently upgraded to VS 2012 to experience some of the new features in C++11 like ranged for loops. However I seem to be running into a problem and have no idea where I'm going wrong. Here's the code in question:
That's because i in that code does not assume the index across it's range.
It is a reference to the character itself.
Ditch str[], and keep the i, only probably call it c or something. Otherwise, you are indexing into the string with ascii values, hence the subscript out of range error message.