短路求值

#include<iostream>
using namespace std;
int main()
{
    int a=3,b=3;
    (a=0)&&(b=5);
    printf("a=%d,b=%d\n",a,b); 
    (a=1)||(b=5);
    printf("a=%d,b=%d",a,b); 
} 

a=0为假所以没有对B进行操作

a=1为真,所以没有对b进行操作

posted @ 2019-06-25 11:58  Hello_World2020  阅读(215)  评论(0编辑  收藏  举报