首页 > 其他 > 详细

一个关于双目运算符的测试

时间:2021-05-15 12:30:58      阅读:20      评论:0      收藏:0      [点我收藏+]

编译环境 x86_64-w64-mingw32 gcc version 8.1.0
操作系统 window 10 X64

code

#include <stdio.h>

#define uint8_t unsigned char
#define uint32_t unsigned int

int main()
{
    uint8_t logic_1 = 0;
    uint8_t logic_2 = 0;
    uint8_t logic_3 = 0;

for(logic_1 = 0;logic_1 < 2 ; logic_1++)
{
    for(logic_2 = 0;logic_2 < 2 ; logic_2++)
    {
        for(logic_3 = 0; logic_3<2 ; logic_3++)
        {
            if( logic_1 != logic_2 &&  logic_3)
            {
                printf("Is True : logic_1 = %d != logic_2 = %d && logic_3 = %d \r\n",logic_1,logic_2,logic_3);
            }
            else
            {
                printf("Is Flase : logic_1 = %d != logic_2 = %d && logic_3 = %d \r\n",logic_1,logic_2,logic_3);
            }
        }
    }

}

return 0; 
}

显示

PS C:\Users\Administrator\TestLogic> gcc -o main main.c
PS C:\Users\Administrator\TestLogic> ./main.exe
Is Flase : logic_1 = 0 != logic_2 = 0 && logic_3 = 0 
Is Flase : logic_1 = 0 != logic_2 = 0 && logic_3 = 1 
Is Flase : logic_1 = 0 != logic_2 = 1 && logic_3 = 0 
Is True : logic_1 = 0 != logic_2 = 1 && logic_3 = 1  
Is True : logic_1 = 1 != logic_2 = 0 && logic_3 = 0  
Is Flase : logic_1 = 1 != logic_2 = 0 && logic_3 = 1 
Is Flase : logic_1 = 1 != logic_2 = 1 && logic_3 = 0 
Is Flase : logic_1 = 1 != logic_2 = 1 && logic_3 = 1 
PS C:\Users\Administrator\TestLogic> 

一个关于双目运算符的测试

原文:https://www.cnblogs.com/zhouhaocheng---yijianqinxin/p/14771062.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!