📄 ex06-05.cpp
字号:
//EX06-05.cpp
#include <iostream.h> //cout,cin
#include <conio.h> // getch()
#include <stdlib.h> // random
void main()
{ short int a,place,c,c1,c0,i;
randomize();
a = random(10);
cout << "Random data is:"<<hex<<a<<endl;
cout << "Bit place(1-16):";
cin >> place;
c=1;
for (i=0;i<place-1;i++)
c *=2;
c1 = short(c | a);
cout << "Repace 1="<<hex<<c1;
c = short(0xFFFF-c);
c0 = short(c & a);
cout << "\nReplace 0="<<hex<<c0;
getch();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -