码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2021-05-24 10:20:00      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:win   编译   turn   logic   运算符   gcc   ini   x86_64   -o   

编译环境 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> 

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

标签:win   编译   turn   logic   运算符   gcc   ini   x86_64   -o   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!