如何在C / C ++中执行no-op? [英] How does one execute a no-op in C/C++?
本文介绍了如何在C / C ++中执行no-op?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
代表以下内容:
( a != b ) ? cout<<"not equal" : cout<<"equal";
假设我不在乎它是否相等,我如何使用上面的语句替换<$
suppose I don't care if it's equal, how can I use the above statement by substituting cout<<"equal"
with a no-op.
推荐答案
如果它真的是一个三元运算符,不需要第二个动作,最好的选择是替换为一个if:
If it really is for a ternary operator that doesn't need a second action, the best option would be to replace it for an if:
if (a!=b) cout << "not equal";
它会闻到很少。
这篇关于如何在C / C ++中执行no-op?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文