Files
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

22 lines
603 B
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include<iostream>
using namespace std;
int main()
{
printf("运算符优先级 非 与 或\n\n");
printf("求下面式子的值:!(3<1)||(67>3)&&(34==43)");
printf("\n答案:%d",!(3<1)||(67>3)&&(34==43));
printf("\n");
printf("\n理由: 1、先计算!(3<1)");
printf("\n 2、再计算(67>3)&&(34==43)");
printf("\n 3、最后!(3<1)||(67>3)&&(34==43)");
printf("这里需要注意的是如果直接用 cout << (67>3)&&(34==43) 会产生错误的结果这与cout本身的机制有关如果想使用cout输出需要这样\n\n");
printf("cout<<((67>3)&&(34==43))<<endl;\n");
cout<<((67>3)&&(34==43))<<endl;
return 0;
}