Problem Info
See the submodule USACO Guide >> Bronze >> Introduction to Sets >> Sorted Sets.
My Work (i.e., copying the code from the USACO.guide to my IDE)
#include<iostream>
#include<set>
using namespace std;
int main()
{
set<int> s;
s.insert(1); // [1]
s.insert(4); // [1, 4]
s.insert(2); // [1, 2, 4]
// Outputs 1, 2, and 4 on separate lines
for (int element : s)
{
cout << element << endl;
}
return 0;
}
Results
Getting the error message
[Error] range-based 'for' loops are not allowed in C++98 mode
for the line with the for-loop.
but it works well on the usaco.guide IDE. My compiler is TDM-GCC 4.9.2 64-bit Release, and IDE is just the (somewhat dated) Dev-C++ (downloaded it here)