Question: I need to have my code resemble this output. I keep on having to restart over. output 1 1 0 0 0 1 1 0

I need to have my code resemble this output. I keep on having to restart over.

output

1 1 0 0 0 1 1 0 Int: 99 String: 01100011 Press any key to close this window . . .

Byte.h

#ifndef BYTE #define BYTE

class Byte1 { private: int bitsToInt(); public: void setValue(int value); Byte1 bite(const Byte1& f); };

#endif

Main.cpp

#include #include "Byte1.h"

using namespace std;

int main() { Byte1 bite;

bite.setValue(99);

for (int i = 0; i < 8; i++) cout << bite.at(i) << endl;

cout << "Int: " << bite.toInt() << endl; cout << "String: " << bite.toString() << endl;

return 0;

Byte.cpp

#include #include "Byte1.h"

using namespace std;

void Byte1::setByte1(int )

You

void setValue(int value) - this function will take as an argument an int type. The argument is going to be the value we want to set our bits to. To set the bits we are going to have to use some bitwise operators. Here is how it works. A value like 65 has a binary value of 0 1 0 0 0 0 0 1 This will require you to make a loop and use AND along with the left shift operators to determine the value of each bit and store it in the array. int at(int index) - takes as an argument an int value ca

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!