Question: #include using namespace std; / / TODO: Implement all the classes and functions to make the following main function / / compiles , works, and
#include
using namespace std;
TODO: Implement all the classes and functions to make the following main function
compiles works, and generates the output given in the Homework file.
int main
typedef int C;
C c ;
Bitter bitterc;
cout "bitter has value bitter endl;
cout "bitter has bitternumberOfSetBits set bits inside" endl endl;
Bitter bitterc;
cout "bitter is created from the same object" endl;
cout "bitter has value bitter endl endl;
cout "flipping the th and rd bits of bitter endl;
bitterflipBit;
bitterflipBit;
cout "bitter has value bitter endl;
cout "bitter has value bitter endl;
cout "bitter has bitternumberOfSetBits set bits inside" endl endl;
cout "setting the st bit of bitter to and rd bit of bitter to endl;
bittersetBit;
bittersetBit;
cout "bitter has value bitter endl;
cout "bitter has value bitter endl endl;
cout "setting the th bit of bitter to endl;
ifbittersetBit
cout "you are out of index: bittergetSize endl;
else
cout "set is done successfully endl;
cout "bitter has value bitter endl endl;
cout "negating the bits of bitter endl;
bitternegate;
cout "bitter has value bitter endl endl;
cout "shifting bitter to the left and put for the new bits" endl;
bittershiftLeft;
cout "bitter has value bitter endl endl;
cout "shifting bitter to the right and put for the new bits" endl;
bittershiftRight;
cout "bitter has value bitter endl endl;
cout we are using an iterator to obtain the decimal value of bitter endl ;
BITerator btrbitter;
unsigned long long value;
value ;
forbtrinit; btrhasMore;
value btrcurrent;
btrnext;
ifbtrhasMore
value ;
cout "value for bitter is value endl;
bitternegate;
value ;
forbtrinit; btrhasMore;
value btrcurrent;
btrnext;
ifbtrhasMore
value ;
cout "value for bitter is value endl endl;
return ;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
