#include<stdio.h>
int main() {
/*__________________1、关系运算符______________________________*/
//5是大于4的,所以结果为真,C语言里面真用1表示
int a1 = 5 > 4;
printf("a1:%d\n",a1);
int a2 = 5 < 4;
printf("a2:%d\n",a2);
int a3 = 5 >= 4; //结果为真
printf("a3:%d\n",a3);
int b1 = 10,b2 = 10;
//比较两个值是否相等
int r1 = b1 == b2;
int r2 = b1 != b2;
printf("r1:%d r2:%d\n",r1,r2);
//注意:
//先计算 3>2 再计算 ==
int c1 = 1 == 3 > 2;
printf("%d \n",c1);
//结合方向是”从左往右“,先计算 4>3
int c2 = 4 > 3 > 2;
//先计算算术运算符,再计算关系运算符
int c3 = 3+4 > 8-2;
/*__________________2、逻辑运算符______________________________*/
//1.逻辑与 &&
int a = 4; //a = 6;
//判断a是否在(3,5)之间
// int result1 = 3<a<5; 错误的
int result1 = (a>3) && (a<5);
//2、逻辑或
//判断b是否在(3,5)之外
int b = 10;
int result2 = (b <= 3) || (b >= 5);
printf("result2:%d\n", result2);
//3、逻辑非 !
int result3 = !(a > 0);
printf("result3:%d\n",result3 );
//算术运算符、关系运算符、逻辑运算符
int a4 = !1 + 5; //结果是5,说明!优先级大于算术运算符
printf("%d\n",a4 );
// 优先级:() > ! > 算术运算符>关系运算符>&&>||>赋值运算符
/*____________________3、三目运算符_________________________________*/
int score;
//C语言里面的去地址符号:&
scanf("%d",&score);
char cj = score >= 60 ? 'Y':'N';
printf("及格了吗:%c\n", cj);
return 0;
}