IntComputer Definition
Table of Contents
1. Write a Class that follows this format
class IntComp{ private: //Not fully Implemented char* memory; int counter; public: IntComp(int); IntComp& operator+=(std::vector<int>); IntComp& operator++(); IntComp& operator--(); void setMemory(char*); char* getMemory(); }
2. Function definitions are below.
operator+=()
Takes in a Vector of \(3\) commands that are as follows:
- operator (\(+,-,*,/\)):(0,1,2,3)
- value (\(0-100\))
- Place in Memory to store
- ex.
- Input: {\(0, 34, 5\)}
- Memory: [0|0|0|0|0|0]
- Command: Memory[5] = Memory[counter]+34; counter++;
operator++()
Increments \(counter\) by 1
operator+-()
Decrement \(counter\) by 1
setMemory(char*)
Take in a pointer and set the current memory to the new memory
getMemory()
return the current Memory block
2.0.1. Part 2
- Turn this class into a Template Class.
2.0.2. Part 3
- Manipulate the memory using only \emph{Pointer Arithmatic}
2.0.3. Part 4
- Complete this Challenge on AoC https://adventofcode.com/2019/day/2