实例2 关系和逻辑运算

2019/7/24 15:15:01 人评论 次浏览 分类:学习教程

原文链接:http://www.cnblogs.com/hnrainll/archive/2011/02/18/1957450.html
//实例2 关系和逻辑运算

#include <stdio.h>

void main()
{
int logic;
int a = 1;
int b = 2;
int c = 3;

logic = a + b > c && b <= c;//首先计算a+b是3不大于c,为假,就不会计算后面了,输出0
printf("logic = %d\n", logic);

logic = a >= b + c || b == c;//b+c是5,a是小于5的,为假;输出0
printf("logic = %d\n", logic);

logic = !(a < c) + b != 1&& (a + c)/2;//1与上2为1
printf("logic = %d\n", logic);
}

转载于:https://www.cnblogs.com/hnrainll/archive/2011/02/18/1957450.html

相关资讯

    暂无相关的资讯...

共有访客发表了评论 网友评论

验证码: 看不清楚?
    -->