C++与pyhton三目运算符

python

# 三目运算符
a = 1
b = 0
c = a if a>b else b

true为a,false为b

C++

//三目运算符
int a = 1;
int b = 0;
c = (a>b ? a:b);

true为a,false为b

猜你喜欢

转载自blog.csdn.net/m0_51641607/article/details/113829898
今日推荐