关系运算符 :
> ,<, <= ,>=,==,!=
返回的是个bool类型的
关系运算符高于赋值运算符低于一般算式运算符
C#中bool只能有true和false,不能用0 或者非0代替
逻辑运算符
逻辑或预算 ||
逻辑与预算符 &&
逻辑运算中的短路现象(就是说如果前面一个可以确定整个的结果,就不对后面运算了)
逻辑非运算符 !
练习:
Console.WriteLine ("输入a:"); string stra =Console.ReadLine (); Console.WriteLine ("输入b:"); string strb =Console.ReadLine (); Console.WriteLine ("输入c:"); string strc =Console.ReadLine (); bool ismax; int aint = int.Parse (stra); int bint = int.Parse (strb); int cint = int.Parse (strc); ismax = (aint > bint) && (aint > cint); Console.WriteLine (ismax);
链接:http://edu.csdn.net/course/detail/1982/30926?auto_start=1
转载请注明原文地址: https://ju.6miu.com/read-1125265.html