正在加载图片...
例8.1】实例 门【例81】编写程序完成对两个整型量进行按位逻辑运算。 程序名为8_1cpp 语|# include" stdio. h 运行情况为: maino input the numbers:输入:9,5<CR 程 i int a, b 序 i% printf("input the e numbers 计 scanf(%d%"&a&kb) printf("odn"akb)殚输出按位与结果*/65526 printf("%\n"2b),/*输出按位或结果* printf( %od n", a'b/,输出按位异或结果 6 printf("auin-a)/输出a的按位取反结果* 程序演刁 环 境 区回本节目录【例8.1】实例 《 C 语 言 程 序 设 计 》(Visual C++ .6 0 环 境 ) 返回本节目录 程序演示 【例8.1】编写程序完成对两个整型量进行按位逻辑运算。 程序名为l8_1.cpp。 #include "stdio.h" main() { int a,b; printf("input the numbers: "); scanf("%d,%d",&a,&b); printf("%d\n",a&b); /*输出按位与结果*/ printf("%d\n",a|b); /*输出按位或结果*/ printf("%d\n",a^b); /*输出按位异或结果*/ printf("%u\n",~a); /*输出 a的按位取反结果*/ } 运行情况为: input the numbers: 输入:9,5 < CR > 1 13 12 65526
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有