首页 >> 民生视野

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

民生视野  2021-08-24 13:32 字号: 大 中 小

【程序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);

}

新标门窗质量
南京哪家医院白癜风好
昭通白癜风医院有哪些
推荐资讯