I come, I see, I conquer

                    —Gaius Julius Caesar

  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 :: 管理 ::
#include <stdio.h>

main()
{
    
/*德.摩根律*/
    
int x=5, y=5;

    printf(
"x = %d, y = %d \n", x, y);
    printf(
"!(x<5) && !(y>=7) = %s \n"!(x<5&& !(y>=7? "true" : "false");
    printf(
"!((x<5) || (y>=7)) = %s \n"!((x<5|| (y>=7)) ? "true" : "false");

    printf(
"---------------------------------\n");

    
/*逻辑运算符*/

    
int a=0, b=5;

    printf(
"a && ++b = %d \n", a && ++b);
    printf(
"b = %d \n", b);

    printf(
"b || ++a = %d \n", b || ++a);
    printf(
"a = %d \n", a);

    
return 0;
}

 

输出:

x = 5, y = 5
!(x<5) && !(y>=7) = true
!((x<5) || (y>=7)) = true
---------------------------------
a && ++b = 0
b = 5
b || ++a = 1
a = 0

 

posted on 2008-09-15 19:44  jcsu  阅读(314)  评论(0)    收藏  举报