Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Android 4 Application Development

Authors: Reto Meier

3rd Edition

1118223853, 9781118223857

More Books

Students also viewed these Programming questions

Question

Distinguish clearly between marketing plans and marketing programs.

Answered: 1 week ago