I was working on a little C++ project at home, which I brought into school to show my teacher. At home I have Visual Studio 2012, whereas the school computers have Visual Studio
The "range for" is a C++ 11 feature that was added in Visual Studio 2012. To learn more about which C++ 11 features are in Visual Studio 2008 (VC9) and Visual Studio 2010 (VC10), check the blog entry from the Visual C++ team. There are similar tables to let you know about Visual Studio 2012 and several different releases of Visual Studio 2013.
Bottom line: your for
loop that you did at home is great if you have Visual Studio 2012. If you don't, use a regular for
or std::for_each
, not the for each
you're using there.