Compare commits

..

No commits in common. "6f86054fb618fc38b631c8d6f6cc49b9fe1fa7c4" and "1a98dde7d59d5ac73a40b469187ace0ae2fbb85e" have entirely different histories.

2 changed files with 0 additions and 45 deletions

View File

@ -1,26 +0,0 @@
#include <iostream>
using namespace std;
int main()
{
// 定义 Linux 的文件权限
int r = 4, w = 2, x = 1;
int n = 0;
// 为 n 值添加 r 和 w 权限
n = r | w; // 6: | 位或运算符
cout << "n = " << n << endl; // 6
// 为 n 值添加 x 权限
n |= x; // 7
cout << "n = " << n << endl; // 7
// 验证 n 是否包含 w 权限
if (n & w == w) // 7 & 2 == 2: & 位与运算符
{
cout << "n 包含 w 权限" << endl;
}
return 0;
}

View File

@ -1,19 +0,0 @@
/*
01 10
1
-9 8, 10 -11
*/
#include <iostream>
using namespace std;
int main()
{
int n = 10;
cout << "~10 = " << ~n << endl; // -11 : ~ 位非运算符: 二进制取反: 0000 1010 => 1111 0101 => -11
n = -9;
cout << "~(-9) = " << ~n << endl; // 8 : ~ 位非运算符: 二进制取反: 1000 1001 => 0111 0110 => 8
return 0;
}