d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Bit Vector Implementation C++ > Need Some Clarification
Add Reply New Topic New Poll
Member
Posts: 23,502
Joined: Aug 3 2011
Gold: 6,921.00
Aug 13 2017 01:43pm
Alright so I'm working on sets (unions, makenull, insert, delete, assign, intersect, and difference etc.)
Just to give an example: Set one contains {1,5} set 2 contains {2,5}
I want to implement a bitvector of 26 (so it can do both numbers and characters) and just return {1,2,5} or in binary this would see {0,1,1,0,0,1,0....}
Just confused on how to implement this. Any help appreciated :)
Member
Posts: 6,266
Joined: May 10 2017
Gold: 1,500.00
Aug 13 2017 09:11pm
instructions unclear
Member
Posts: 16,621
Joined: Jan 7 2017
Gold: 90.58
Aug 14 2017 02:16am
instructions unclear

created D3 :lol:

This post was edited by JohnMiller92 on Aug 14 2017 02:17am
Member
Posts: 184
Joined: May 12 2017
Gold: 1,435.00
Aug 19 2017 10:52am
#include <iostream>
#include <bitset>
using namespace std;

int main(int argc, char* argv[])
{
bitset<4> b1("1101"), b2("1011");
// union
bitset<4> u = b1 | b2;
cout << u << "\n";
//intersect
bitset<4> i = b1 & b2;
cout << i << "\n";
//difference
bitset<4> d = b1 & ~(b1 & b2);
cout << d << "\n";
system("pause");
return 0;
}
Member
Posts: 4,009
Joined: May 25 2015
Gold: 13,020.00
Aug 25 2017 11:40am
C++ doesn't apply in 2017. You should try it with the Arduino. Arduino is the new version of the old version C++.
Member
Posts: 1,039
Joined: Jul 8 2008
Gold: 1,939.50
Aug 26 2017 10:51am
Quote (0perator @ Aug 25 2017 12:40pm)
C++ doesn't apply in 2017. You should try it with the Arduino. Arduino is the new version of the old version C++.


This seems like an uninformed opinion to me...
Member
Posts: 4,009
Joined: May 25 2015
Gold: 13,020.00
Aug 26 2017 01:12pm
Quote (waraholic @ 26 Aug 2017 12:51)
This seems like an uninformed opinion to me...


I didn't talk to you, the owner of this post is "Cocoo".
Member
Posts: 23,502
Joined: Aug 3 2011
Gold: 6,921.00
Aug 26 2017 06:01pm
Quote (0perator @ Aug 26 2017 12:12pm)
I didn't talk to you, the owner of this post is "Cocoo".


Arduino? Never heard of it o.o but I have visual studios 2017, does it work?
Member
Posts: 4,009
Joined: May 25 2015
Gold: 13,020.00
Aug 26 2017 09:55pm
Quote (Cocoo @ 26 Aug 2017 20:01)
Arduino? Never heard of it o.o but I have visual studios 2017, does it work?


Arduino is the new version of C++ for a few years ago. Maybe, you can have the chance to use it if you work in an industry.
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll