DeMorgan's law and C++

后端 未结 1 393
太阳男子
太阳男子 2021-01-16 07:37

For each of the following write the equivalent C++ expressions, without any unary negation operators (!). (!= is still permitted)

Use DeMorgan\'s law

  • <
相关标签:
1条回答
  • 2021-01-16 07:58

    Check this out:

    !(x!=5 && x!=7)                 -->    x==5 || x==7
    
    !(x<5 || x>=7)                  -->    x>=5 && x<7
    
    !( !(a>3 && b>4) && (c != 5))   -->    (a>3 && b>4) || c==5
    

    So, just #2 from your solutions is correct.

    0 讨论(0)
提交回复
热议问题