【发布时间】:2011-08-25 18:26:43
【问题描述】:
我想知道我在 C++ 代码中经常看到的 <?= 运算符是什么。它不能在我的系统上编译,但我确信它是正确的。是这样使用的:a <?= something;
另外,我需要做什么才能编译它?
编辑帖子:
请参阅此源代码(它是练习Google Code Jam 比赛获胜者的问题 Square Fields(问题 B)的解决方案 -- 请参阅 here)。我在其他一些提交中也看到了相同的字符模式。
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<numeric>
#include<cmath> using namespace std;
#define ALL(t) t.begin(),t.end()
#define FOR(i,n) for (int i=0; i<(int)(n); i++)
#define FOREACH(i,t) for (typeof(t.begin()) i=t.begin(); i!=t.end(); i++) typedef vector<int> vi; typedef long long int64;
int t[15][1<<15]; int main() { int N;cin>>N; for(int c=1;c<=N;c++){
int n,k,x[30],y[30];
cin>>n>>k;
FOR(i,n)cin>>x[i]>>y[i];
FOR(take,1<<n)if(take){
int minx=1000000,maxx=-1,miny=1000000,maxy=-1;
FOR(i,n)if(take&1<<i)minx<?=x[i],maxx>?=x[i],miny<?=y[i],maxy>?=y[i];
t[1][take]=(maxx-minx)>?(maxy-miny); // cout<<take<<" "<<t[1][take]<<endl;
}
for(int kk=2;kk<=k;kk++)FOR(take,1<<n){
t[kk][take]=t[kk-1][take];
for(int take2=take;take2;take2=(take2-1)&take)
t[kk][take]<?=t[kk-1][take-take2]>?t[1][take2];
}
cout<<"Case #"<<c<<": "<<t[k][(1<<n)-1]<<endl; } return 0; }
【问题讨论】:
-
你错了,没有这样的运算符。也许您看到了类似的东西并弄乱了顺序。
-
可能由于代码页问题导致代码出现乱码。 C++ 中没有这样的运算符。
-
它一定是一个错字,并且不可能在一个合理一致的 C++ 编译器上编译。这不是a trigraph nor a digraph,而且在我从事 C++ 编程的这些年里,我从未在 C++ 代码中看到过
<?=。你能提供更多的上下文吗? (比如说,你发现的代码 sn-p 有这个?)你正在查看的代码可能根本不是 C++。 -
It doesn't compile on my system, but I'm sure it is correct.编译线索不够,它不正确吗?学会相信你的编译器——在这些事情上它比你更经常是正确的...... :) -
刚刚发现是an extension present in older versions of the GCC C++ compiler,这可能是我从未见过这样的运营商的原因。作为副本关闭。