Question: Problem 2: Suppose we declare cells by enum Digits {0, 1}; struct CellType { Digits bit; CellType* next; }; 2 A binary number b1b2 .
Problem 2: Suppose we declare cells by enum Digits {0, 1}; struct CellType { Digits bit; CellType* next; }; 2 A binary number b1b2 . . . bn, where each bi is 0 or 1, has numerical value . This number can be represented by the list b1, b2 , . . . , bn. That list, in turn, can be represented as a linked list of cells of type CellType. 1. Provide a minimum C++ class to solve this problem. That is, the least number of member functions and data members that should be included in your C++ class. 2. Write an algorithm increment that adds one to a binary number. 3. Give the corresponding C++ member function. Your member function should be commented appropriately for readability and understanding. 4. Provide a C++ implementation of your proposed C++ class.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
