Question: #Must be in C + + ( Data Structures / Algorithms ) and have no errors, I've got it partially done in Part 1 but
#Must be in CData StructuresAlgorithms and have no errors, I've got it partially done in Part but Im stumped, here's my code:
beginning of main
#include
#include "BitsByte.h
using namespace std;
int main
Byte bite;
Test setValue function
bite.setValue;
Test at function
for int i ; i ; i
cout bite.ati endl;
Test toInt and toString functions
cout "Int: bite.toInt endl;
cout "String: bite.toString endl;
return ;
main ends
BitsByte.cpp begins
#include "BitsByte.h
Convert bits to integer
int Byte::bitsToInt
int value ;
for int i ; i ; i
value bitsi i;
return value;
Sets the value of bits
void Byte::setValueint value
for int i ; i ; i
bitsivalue & ;
value ;
Function to get the bit at specific indexs
int Byte::atint index
return bitsindex;
Converts bits to strings
std::string Byte::toString
std::string str;
for int i ; i ; i Loop from index to
str std::tostringbitsi;
return str;
Converts bits to integer
int Byte::toInt
return bitsToInt;
BitsByte.cpp ends
BitsByte.h begins
#ifndef BYTEH
#define BYTEH
#include
class Byte
private:
int bits;
int bitsToInt;
public:
void setValueint value;
int atint index;
std::string toString;
int toInt;
Constructors
;
#endif
BitsByte.h ends
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
