ylbtech-Arithmetic:Console-算法[运算符]-学习使用按位取反~ |
1.A,Demo(案例) |
【程序55】
题目:学习使用按位取反~。
1.程序分析:~0=1; ~1=0;
1.B,Solution(解决方案) |
using System; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { int a, b; a = 224; b = ~a; Console.WriteLine("The a's 1 complement(decimal) is {0}",b); a = ~a; Console.WriteLine("The a's 1 complement(hexidecimal) is {0}",a); } } }
1.C,Execution Result(运行结果) |
The a's 1 complement(decimal) is -225 The a's 1 complement(hexidecimal) is -225 请按任意键继续. . .
本文转自ylbtech博客园博客,原文链接:http://www.cnblogs.com/ylbtech/archive/2013/05/07/3064722.html,如需转载请自行联系原作者