位运算,位移,窗体
来源:互联网 发布:win7系统优化 编辑:程序博客网 时间:2024/05/29 21:37
//BitMove.cs
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;namespace BitArray.Algo { public partial class BitMove : Form { public BitMove() { //构造器 InitializeComponent(); } // Windows generated code omitted private StringBuilder ConvertBits(int val) { //二进制转化器 int bitMask = 1 << 31; StringBuilder bitBuffer = new StringBuilder(35); for (int i = 1; i <= 32; i++) { if ((val & bitMask) == 0) bitBuffer.Append("0"); else bitBuffer.Append("1"); val <<= 1; if ((i % 8) == 0) bitBuffer.Append(" "); } return bitBuffer; } //二进制转化器 private void btnLeft_Click(object sender, EventArgs e) { //控件位置提醒Integer to shift: txtInt1 //控件位置提醒Bit to shift: txtBitShift //lblOrigBits 是line 1 的32位 二进制数 //lblInt1Bits 是line 2 的32位 二进制数 int value = Int32.Parse(txtInt1.Text); lblOrigBits.Text = ConvertBits(value).ToString(); //二进制 输出 value <<= Int32.Parse(txtBitShift.Text); //shift移动 输入框 输入的 位数 lblInt1Bits.Text = ConvertBits(value).ToString(); //二进制 输出 } private void btnRight_Click(object sender, EventArgs e) { int value = Int32.Parse(txtInt1.Text); lblOrigBits.Text = ConvertBits(value).ToString(); //二进制 输出 value >>= Int32.Parse(txtBitShift.Text); //shift移动 输入框 输入的 位数 lblInt1Bits.Text = ConvertBits(value).ToString(); //二进制 输出 } private void btnClear_Click(object sender, EventArgs e) { txtInt1.Text = ""; txtInt1.Text = ""; lblOrigBits.Text = ""; lblOrigBits.Text = ""; txtInt1.Focus(); } }//public partial class BitMove : Form}//namespace BitArray.Algo
0 0
- 位运算,位移,窗体
- 位移位运算符
- 位运算符和位移运算符
- 010.php位运算和位移运算
- Java中的位运算、位移运算
- C语言中位移位运算符
- C语言中位移位运算符
- C语言中位移位运算符
- C语言中位移位运算符
- javaSE基础_位运算及位移运算
- JAVA 位运算符和位移运算符
- C语言中位运算符--位移运算符
- JAVA 位运算符和位移运算符
- JAVA 位运算符和位移运算符
- 位移运算符和位运算符的计算
- 位移运算
- 位移,&,|,^运算
- 位移运算
- ubuntu下libpcap的安装
- opencv 判断点相对于轮廓的位置关系
- 高并发解决方案——提升高并发量服务器性能解决思路
- ES6(四) 变量的解构赋值
- Hrbust 2171 最佳工厂【贪心+优先队列】经典题型
- 位运算,位移,窗体
- ObjectOutputStream 与 ObjectInputStream创建的先后顺序
- Java集合---ConcurrentHashMap原理分析
- Vue.js入门
- C++中find函数用法
- Eclipse Maven 更新或者导入中异常关闭无法启动
- [转] C++中字符型变量的地址输出
- hdu1847(巴什博弈)
- uva10041