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.

  1. operator+=()

    Takes in a Vector of \(3\) commands that are as follows:

    1. operator (\(+,-,*,/\)):(0,1,2,3)
    2. value (\(0-100\))
    3. Place in Memory to store
    • ex.
      • Input: {\(0, 34, 5\)}
      • Memory: [0|0|0|0|0|0]
      • Command: Memory[5] = Memory[counter]+34; counter++;
  2. operator++()

    Increments \(counter\) by 1

  3. operator+-()

    Decrement \(counter\) by 1

  4. setMemory(char*)

    Take in a pointer and set the current memory to the new memory

  5. 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

Author: Aiden Thomas

Created: 2025-02-23 Sun 21:27