#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
typedef std::pair<bool,bool> magnet;
// typedef long long LL;
// const int N=;
using namespace std;
int n;// number
vector<magnet> st;// status
int main()
{
// #ifndef ONLINE_JUDGE
// freopen(".in","r",stdin);
// freopen(".out","w",stdout);
// #endif
// input
scanf("%d",&n);
// input magnet
for(int i=0;i<n;i++)
{
int l,r;
scanf("%d%d",&l,&r);
st.push_back(make_pair(l,r));
}
for(auto& p:st)
{
printf("%d ",p);
}
puts("\n");
// // count
// int cnt=0;
// for(int i=1;i<n;i++)
// {
// if(st[i].first==st[i-1].second)
// {
// cnt++;
// }
// }
// // output
// printf("%d\n",cnt);
return 0;
}
当我debug这段代码时,vscode提示我:
error: range-based 'for' loops are not allowed in C++
98 mode
for(auto& p:st)
^
可我的编译命令是:
cd "f:\wty's_folder\vscode_en_folder\" ; i
f ($?) { g++ CF344A_Magnets.cpp -o CF344A_Magnets } ; if ($?) { .\CF344A_Magnet
s -std=c++14 -O2 -Wall -static }
使用了-std=c++14,求dalao解释为何会CE