24663人加入学习
(72人评价)
C#编程-第一季-编程基础-宇宙最简单2021最新版

制作完成于2021年10月10日,使用Visual Studio 2019

价格 免费

A = true  B =false

(A&&B)= FALSE

(A||B)= TRUE

!(A&&B)=TRUE

[展开全文]
using System;

namespace _010_逻辑运算符
{
    class Program
    {
        static void Main(string[] args)
        {
            // &&和    ||或    !非
            //bool a = (3 < 4) && (9 < 10);// true && true
            bool a = true && true;

            bool b = (3 < 2) || (9 < 7);

            //bool c = !(4 < 7);
            bool c = !true;//取反

            Console.WriteLine(a);
            Console.WriteLine(b);
            Console.WriteLine(c);
        }
    }
}

 

[展开全文]

&& 同时满足

|| 任意一个满足

!不满足则为zhen

[展开全文]

逻辑运算符

0.bool函数,用于判断运算结果为Ture 或者 False

1.逻辑运算符一共有三类,逻辑与“&&”;逻辑或“||”;以及逻辑非“!”

2.“&&”逻辑与代表需要同时两个条件时,为Ture,例:(A&&B)即条件A与B都打成时为Ture;

3.“||”逻辑或代表直须满足一个条件,为Ture,例:(A||B)即满足条件A或条件B时,为Ture

4.“!”逻辑非则是逆转操作数的逻辑状态,如果条件为Ture则逻辑非运算符使其为False。例:bool c = !(4 < 7);运算为false,但是逻辑非使其运算结果为Ture

 

[展开全文]

bool a=(3<4)&&(9>6);

bool b=(3<4)||(9>6);

bool c=!(9>6);

bool d=!true;

[展开全文]

授课教师

SiKi学院老师

课程特色

下载资料(1)
视频(118)
图文(1)