I am trying to compile a program using a new C++ feature but cannot,
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#include <iostream>
usingnamespace std;
int main() {
int a[10]={1,2,3,4,5,6,7,8,9,0};
for(int n : a){
cout << n << " ";
}
return 0;
}
I get the Compilation Error
range-based-for loops are not allowed in C++98 mode
How to compile with new mode, tried the "-ansi" command with compiler but no use. can some one tell me how can I use new features, The compiler does recognize them as far as error message is telling but how to tell compiler to compile using new modes (0x or 11). I am using DevC++ with MinGW 4.6.1 (latest I think).