我看到?=在代码中使用:
http://community.topcoder.com/stat?c=problem_solution&rm=151152&rd=5854&pm=2923&cr=310333
我尝试编译没有包括测试它是否是标准,但它不起作用.然后我添加了包含,但它仍然给出了同样的错误:
question-mark.cpp:15:5: error: expected primary-expression before ‘?’
token question-mark.cpp:15:6: error: expected primary-expression
before ‘=’ token question-mark.cpp:15:9: error: expected ‘:’ before
‘;’ token question-mark.cpp:15:9: error: expected primary-expression
before ‘;’ token
#include
#include
#include
#include
#include
#include
using namespace std;
int main()
{
int x = 3;
int y = 2;
x >?= y;
printf("x = %d\n", x);
return 0;
}
以下是链接代码中的使用方法:
x = h[i][j]; // x = (h[i][j] < x) ? h[i][j] : x;
我怎样才能做到这一点?