c#这句怎么解释思维逻辑什么意思先后关系?

1、bool类型在c#中我们用bool类型来描述对或者错。bool类型的值只有两个 一个true 一个false2、逻辑运算符&& 逻辑与
逻辑或!逻辑非有逻辑运算符连接的表达式叫做逻辑表达式逻辑运算符两边放的一般都是关系表达式或者bool类型的值。如:5>3 &&true3>5
false!表达式逻辑表达式的结果同样也是bool类型3、复合赋值运算符int number=10;+= :number+=20;number=number+20;-=number-=5;number=number-5;=number=5;number=number*5;/=%=using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _07逻辑运算符练习
{
class Program
{
static void Main(string[] args)
{
//让用户输入老苏的语文和数学成绩,输出以下判断是否正确,正确输出True,错误输出False
//1)老苏的语文和数学成绩都大于90分
Console.WriteLine("小苏,输入你的语文成绩");
//string strChinese = Console.ReadLine();
int chinese = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("小苏,请输入你的数学成绩");
int math = Convert.ToInt32(Console.ReadLine());
//bool b = chinese > 90 && math > 90;
bool b = chinese > 90
math > 90;
Console.WriteLine(b);
Console.ReadKey();
//2)语文和数学有一门是大于90分的
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _08判断闰年
{
class Program
{
static void Main(string[] args)
{
//Console.WriteLine("请输入要判断的年份");
//int year = Convert.ToInt32(Console.ReadLine());
年份能够被400整除.(2000)
年份能够被4整除但不能被100整除.(2008)
逻辑与的优先级要高于逻辑或
//bool b = (year % 400 == 0)
(year % 4 == 0 && year % 100 != 0);
//Console.WriteLine(b);
//Console.ReadKey();
//
bool b = 5 < 3 && 5 > 3;
bool b = 5 > 3
4 < 3;
}
}
}

我要回帖

更多关于 思维逻辑什么意思 的文章

 

随机推荐