条件运算符?:

c++里必须得赋值给某个变量,然后才可cout变量;不能直接 cout<<(f(i)==1)?"能赢":"不能赢";

必须

string s=(f(i)==1)?"能赢":"不能赢";

cout<<i<<':'<<s<<endl;

我也不知道为什么

原文地址:https://www.cnblogs.com/zhangshuyao/p/8601242.html