加入高低位交换

This commit is contained in:
James 2020-03-14 12:43:08 +08:00
parent 615957162a
commit d065a5de96
12 changed files with 66 additions and 0 deletions

View File

@ -0,0 +1,3 @@
# 标题
* 内容

View File

@ -0,0 +1,3 @@
# 标题
* 内容

Binary file not shown.

View File

@ -0,0 +1,33 @@
// #define DEBUG
#include <iostream>
using namespace std;
int main()
{
unsigned n;
int a[33] = { 0 }, i = 0, s = 1;
cin >> n;
while (n > 0) {
a[++i] = n % 2;
//cout<<a[i];
n /= 2;
}
#ifdef DEBUG
for (int j = 32; j >= 1; j--) {
if (j % 4 == 0)
cout << " ";
cout << a[j];
}
cout << endl;
#endif // DEBUG
for (int j = 1; j <= 16; j++) {
n += a[j + 16] * s;
s *= 2;
}
for (int j = 1; j <= 16; j++) {
n += a[j] * s;
s *= 2;
}
cout << n;
}

Binary file not shown.

View File

@ -0,0 +1,6 @@
#include <iostream>
int main()
{
std::cout << "Hello Easy C++ project!" << std::endl;
}

BIN
2013_highlowchange/main.exe Normal file

Binary file not shown.

View File

@ -0,0 +1 @@
23

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1,12 @@
## z:\Chao\src\2013_highlowchange\test\in.txt
2020/03/14 ÖÜÁù 12:33:59.81
1507328
-----------------------------------------------
Process exited after 320 ms with return value 0
## z:\Chao\src\2013_highlowchange\test\in2.txt
2020/03/14 ÖÜÁù 12:33:59.81
65536
-----------------------------------------------
Process exited after 120 ms with return value 0

Binary file not shown.

7
Template/test/out.txt Normal file
View File

@ -0,0 +1,7 @@
## z:\Chao\src\Template\test\in.txt
2020/03/14 ÖÜÁù 11:41:28.68
Hello Easy C++ project!
-----------------------------------------------
Process exited after 200 ms with return value 0