-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcounting.cpp
67 lines (57 loc) · 1.32 KB
/
counting.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// 2017-Jul-14 02:56
#include <iostream>
void loop(int power) {
uint32_t ter = 0;
uint32_t num = 2;
for (int i = 0; i < power-1; i++) {
num *= 2;
}
std::cout << "2^" << power << ":" << std::endl;
for (int i = 0; i < num; i++) {
std::cout << "\r" << std::flush;
ter++;
std::bitset<32> b(ter);
std::cout << b;
// std::cout << ter;
}
// std::cout << ter;
std::cout << std::endl;
}
int main() {
// loop(16);
// loop(18);
// loop(20);
// loop(22);
// loop(24);
// loop(26);
// loop(28);
// loop(30);
// loop(32);
std::cout << std::bitset<256> (0) << std::endl;
return 0;
}
/* Python counting
ter = 0
for i in range(512):
if ter == 0: ter += 2
else: ter *= 2
if (i+1) < 10: print("{} {}".format(i+1, (ter)))
elif (i+1) < 100: print("{} {}".format(i+1, (ter)))
else: print("{} {}".format(i+1, (ter)))
num = 2**25
ter = 0
for i in range(num):
ter += 1
print("{}".format(ter), end="\r")
sys.stdout.flush()
if i == num:
print("")
sys.stdout.write("{} \r".format(ter) )
sys.stdout.flush()
import sys
for i in range(10**6):
perc = float(i) / 10**6 * 100
print(">>> Download is {}% complete".format(perc), end = "\r")
sys.stdout.flush()
print("")
*/