加入高低位交换
This commit is contained in:
parent
615957162a
commit
d065a5de96
3
2013_highlowchange/Readme.md
Normal file
3
2013_highlowchange/Readme.md
Normal file
@ -0,0 +1,3 @@
|
||||
# 标题
|
||||
|
||||
* 内容
|
3
2013_highlowchange/doc/Readme.md
Normal file
3
2013_highlowchange/doc/Readme.md
Normal file
@ -0,0 +1,3 @@
|
||||
# 标题
|
||||
|
||||
* 内容
|
BIN
2013_highlowchange/doc/高低位交换.pdf
Normal file
BIN
2013_highlowchange/doc/高低位交换.pdf
Normal file
Binary file not shown.
33
2013_highlowchange/highlowchange.cpp
Normal file
33
2013_highlowchange/highlowchange.cpp
Normal 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;
|
||||
}
|
BIN
2013_highlowchange/highlowchange.exe
Normal file
BIN
2013_highlowchange/highlowchange.exe
Normal file
Binary file not shown.
6
2013_highlowchange/main.cpp
Normal file
6
2013_highlowchange/main.cpp
Normal file
@ -0,0 +1,6 @@
|
||||
#include <iostream>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::cout << "Hello Easy C++ project!" << std::endl;
|
||||
}
|
BIN
2013_highlowchange/main.exe
Normal file
BIN
2013_highlowchange/main.exe
Normal file
Binary file not shown.
1
2013_highlowchange/test/in.txt
Normal file
1
2013_highlowchange/test/in.txt
Normal file
@ -0,0 +1 @@
|
||||
23
|
1
2013_highlowchange/test/in2.txt
Normal file
1
2013_highlowchange/test/in2.txt
Normal file
@ -0,0 +1 @@
|
||||
1
|
12
2013_highlowchange/test/out.txt
Normal file
12
2013_highlowchange/test/out.txt
Normal 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
7
Template/test/out.txt
Normal 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
|
||||
|
Loading…
x
Reference in New Issue
Block a user