-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathDay-574.cpp
More file actions
31 lines (30 loc) · 702 Bytes
/
Day-574.cpp
File metadata and controls
31 lines (30 loc) · 702 Bytes
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
#include <iostream>
#include <vector>
using namespace std;
class bitArray{
private:
vector<bool>baseArray;
public:
void init(const int &x) {
baseArray.resize(x);
}
bool get(const int &i) const {
return baseArray.at(i);
}
void set(const int &index , const int &value) {
baseArray[index] = value;
}
friend ostream& operator<< (ostream&out ,const bitArray&a) {
for(auto itr:a.baseArray) {
out << itr;
}
return out;
}
};
int main(void){
bitArray b;
b.init(100);
b.set(10 , 1);
cout << b << '\n';
return 0;
}