-
Notifications
You must be signed in to change notification settings - Fork 0
/
binaryMac.cpp
108 lines (81 loc) · 1.24 KB
/
binaryMac.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#include<unistd.h>
#include<iostream>
using namespace std;
void clear() {
system("clear");
}
int calibrate() {
int width = 50;
bool atEnd = false;
char in;
while(!atEnd) {
clear();
cout << "a: -5\ns: -1\nd: +1\nf: +5\nw: Input width\ne: Confirm"<<endl;
cout << width <<endl;
for (int n = 1; n <= width; n++) {
cout << "~";
}
cout <<endl;
cin >> in;
if (in == 'a') {
width = width - 5;
}
else if (in == 's') {
width = width - 1;
}
else if (in == 'd') {
width = width + 1;
}
else if (in == 'f') {
width = width + 5;
}
else if (in == 'w') {
clear();
cout << "Enter window width: ";
cin >> width;
atEnd = true;
}
else if (in == 'e') {
atEnd = true;
}
}
return width;
}
int randNum() {
int out;
out = rand() %2;
return out;
}
int calibInit() {
int width;
char calibChar;
clear();
cout << "Calibrate?(y/n): ";
cin >> calibChar;
if (calibChar == 'y') {
width = calibrate();
}
else {
width = 135;
}
return width;
}
int printer() {
int e = 0;
int width = calibInit();
clear();
while (true) {
int n = 0;
while (n < width) {
cout << " ";
cout <<randNum();
n++;
}
cout <<endl;
usleep(60000);
}
return 0;
}
int main() {
printer();
}