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
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
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started