You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
582 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#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;
}