Unable to use 'Range based For Loop' in Sublime Text 3

Here’ the code :


When I run the above code on Sublime Text 3 it says “error: range-based ‘for’ loops are not allowed in C++98 mode”.
I have tried to resolve it on internet but being a newbie I’m unable to understand.

@Akshay01
First, Please increase the V count, because otherwise it will result in seg fault. because you are adding 7,1 when V = 4 .
Now, The build system you are using in sublime might be old. First try to run the code using g++ command in the terminal/command promt . If the problem still persists, then you have to update your compiler.

Even after using g++ command in the command line it displays the same error.

So how can I update my compiller?Any instructions?

@Akshay01 which OS are you using?

Microsoft Windows 10

So how did you installed the compiler in the first place? Mingw or something like that.

Yes MingW following the instructions given the course

Yes, so you just need to do the same process with the latest version of MinGW. Can you send me the screenshot of the error you get while running in the terminal.

Powershell is not necessary, command promt would be fine… Do g++ graph.cpp.

Try
G++ graph.cpp -std=c++17

Try
G++ graph.cpp -std=c++14 then you will have to install latest mingw.