首页 >> 民生历史

语言程序开发经典实例之六呢

民生历史  2021-08-24 13:31 字号: 大 中 小

【程序51】

题目:学习使用按位与 。

1.程序分析:00=0; 01=0; 10=0; 11=1

2.程序源代码:

#include \"stdio.h\"

main()

{

int a,b;

a=077;

b=a3;

printf(\"\\40: The a b(decimal) is %d \\n\",b);

b=7;

printf(\"\\40: The a b(decimal) is %d \\n\",b);

}

【程序52】

题目:学习使用按位或 | 。

1.程序分析:0|0=0; 0|1=1; 1|0=1; 1|1=1

2.程序源代码:

#include \"stdio.h\"

main()

{

int a,b;

a=077;

b=a|3;

printf(\"\\40: The a b(decimal) is %d \\n\",b);

b|=7;

printf(\"\\40: The a b(decimal) is %d \\n\",b);

}

【程序53】

题目:学习使用按位异或 ^ 。

1.程序分析:0^0=0; 0^1=1; 1^0=1; 1^1=0

2.程序源代码:

#include \"stdio.h\"

矿业巨头力拓公司股价上涨2.7% main()

{

int a,b;

a=077;

b=a^3;

printf(\"\\40: The a b(decimal) is %d \\n\",b);

b^=7;

printf(\"\\40: The a b(decimal) is %d \\n\",b);

}

吴忠白癜风医院
柳州哪家医院有男科
石家庄妇科专科
推荐资讯