title: Writing HugeInteger class
body: <p>I am new to C++ and this is what I am suppose to do for an assignment.</p>
  
  <p>Create a class HugeInteger that uses a 40-element array of digits to store integers as large as 40 digits each. Provide member functions input, output, add and subtract. For comparing HugeInteger objects, provide functions isEqualTo, isNotEqualTo, isGreaterThan, isLessThan, isCreaterThanOrEqualTo and isLessThanOrEqualTo - each of these is a "predicate" function that simply returns true if the relationship holds between the two HugeIntegers and returns false if the relationship does not hold. Also, provided predicate function isZero.</p>
  
  <p>Recommendations for extra points: Provide member functions multiply, divide, and modulus.</p>
  
  <hr>
  
  <p>I am having trouble figuring out how to compare two objects in my class. </p>
  
  <p>My header coding looks like this:</p>
  
  <pre><code>#pragma once
  #include &lt;iostream&gt;
  using namespace std;
  
  static const int MAXINTEGER = 40;
  
  //HugeInteger Class
  class HugeInteger
  {
   public:
      HugeInteger(void); //constructor
      ~HugeInteger(void); //destructor
  
      void HugeInteger::input(int[MAXINTEGER]); //input array to internal array
      void HugeInteger::output(void); //write out array to screen
  
      bool isZero(void); //test to see if it is zero
      bool HugeInteger::isEqual(HugeInteger other); //test to see if the objects are equal
      bool HugeInteger::isNotEqual(HugeInteger other); //test to see if the objects are not equal
      bool HugeInteger::isGreaterThan(HugeInteger other); //test to see if one object is greater than the other
      bool HugeInteger::isLessThan(HugeInteger other); //test to see if one object is less than the other
      bool HugeInteger::isGreaterThanOrEqual(HugeInteger other); //test to see if one object is greater than or equal to the other
      bool HugeInteger::isLessThanOrEqual(HugeInteger other); //test to see if one obejct is less than or equal to the other
  
      HugeInteger HugeInteger::add(HugeInteger other); //adds two objects
      HugeInteger HugeInteger::subtract(HugeInteger other); //subtract two objects
      HugeInteger HugeInteger::multiply(HugeInteger other); //multiply two objects
      HugeInteger HugeInteger::divide(HugeInteger other); //divide two objcts
  
  private:
      bool isPositive; //needed when we do subtraction
      int hugeIntergerOne[MAXINTEGER]; //internal array
  };
  </code></pre>
  
  <p>My .cpp coding looks like this:</p>
  
  <pre><code>#include "HugeInteger.h"
  #include &lt;iostream&gt;
  using namespace std;
  
  //HugeInteger Class Functions
  
  HugeInteger::HugeInteger(void) //constructor
  {
      //zero out internal array
      for (int i = MAXINTEGER - 1; i &gt;= 0; i--)
          this -&gt;hugeIntergerOne[i] = 0;
  }
  
  HugeInteger::~HugeInteger() //destructor
  {
      //de-allocates internal array
  }
  
  void HugeInteger::input(int newArray[MAXINTEGER])
  {
      //copies 'newArray' into internal array
      for (int index = MAXINTEGER - 1; index &gt;= 0; index--)
          this-&gt;hugeIntergerOne[index] = newArray[index];
  }
  
  void HugeInteger::output()
  {
      //outputs internal array to screen
      for (int index = 0; index &lt; MAXINTEGER; index++)
          cout &lt;&lt; this-&gt;hugeIntergerOne[index] &lt;&lt; " ";
  }
  
  bool HugeInteger::isZero(void) //test zero function
  {
      bool result = true;
      //test whether every element of internal array is zero
      for (int index = MAXINTEGER - 1; index &gt;= 0; index--)
          if (this-&gt;hugeIntergerOne[index] != 0)
              result = false;
      return result;
  }
  
  bool HugeInteger::isEqual(HugeInteger other) //test equal function
  {
      bool result = true;
      for (int i = 0; i &lt; MAXINTEGER; i++)
          if (this-&gt;hugeIntergerOne[i] != other.hugeIntergerOne[i])
              bool result = false;
      return result;
  }
  
  bool HugeInteger::isNotEqual(HugeInteger other) //test not equal function
  {
      bool result = true;
      for (int index = MAXINTEGER - 1; index &gt;= 0; index--)
          if (this-&gt;hugeIntergerOne[index] == other.hugeIntergerOne[index])
              bool result = false;
      return result;
  }
  
  bool HugeInteger::isGreaterThan(HugeInteger other) //test greater than function
  {
      bool result = false;
      for (int index = MAXINTEGER - 1; index &gt;= 0; index--)
          if (this-&gt;hugeIntergerOne[index] &gt; other.hugeIntergerOne[index])
              bool result = true;
      return result;
  }
  
  bool HugeInteger::isLessThan(HugeInteger other) //test less than function
  {
      bool result = false;
      for (int index = MAXINTEGER - 1; index &gt;= 0; index--)
          if (this-&gt;hugeIntergerOne[index] &lt; other.hugeIntergerOne[index])
              bool result = true;
      return result;
  }
  
  bool HugeInteger::isGreaterThanOrEqual(HugeInteger other) //test greater than or equal function
  {
      bool result = false;
      for (int index = MAXINTEGER - 1; index &gt;= 0; index--)
          if (this-&gt;hugeIntergerOne[index] &gt;= other.hugeIntergerOne[index])
              bool result = true;
      return result;
  }
  
  bool HugeInteger::isLessThanOrEqual(HugeInteger other) //test less than or equal function
  {
      bool result = false;
      for (int index = MAXINTEGER - 1; index &gt;= 0; index--)
          if (this-&gt;hugeIntergerOne[index] &lt;= other.hugeIntergerOne[index])
              bool result = true;
      return result;
  }
  
  HugeInteger HugeInteger::add(HugeInteger other) //adds objects
  {
      HugeInteger result;
      for (int i = 0; i &lt; MAXINTEGER; i++)
      {
          result.hugeIntergerOne[i] = this -&gt; hugeIntergerOne[i] + other.hugeIntergerOne[i];
      }
      return result;
  }
  
  HugeInteger HugeInteger::subtract(HugeInteger other) //subtracts objects
  {
      HugeInteger result;
      for (int i = 0; i &lt; MAXINTEGER; i++)
      {
          result.hugeIntergerOne[i] = this-&gt;hugeIntergerOne[i] - other.hugeIntergerOne[i];
      }
      return result;
  }
  
  HugeInteger HugeInteger::multiply(HugeInteger other) //multiplies objects
  {
      HugeInteger result;
      for (int i = 0; i &lt; MAXINTEGER; i++)
      {
          result.hugeIntergerOne[i] = this-&gt;hugeIntergerOne[i] * other.hugeIntergerOne[i];
      }
      return result;
  }
  
  HugeInteger HugeInteger::divide(HugeInteger other) //divides objects
  {
      HugeInteger result;
      for (int i = 0; i &lt; MAXINTEGER; i++)
      {
          result.hugeIntergerOne[i] = this-&gt;hugeIntergerOne[i]/other.hugeIntergerOne[i];
      }
      return result;
  }
  </code></pre>
  
  <p>And my main programming code looks like this:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include "HugeInteger.h"
  using namespace std;
  
  int main()
  {
      //create three arrays
      int first[MAXINTEGER] = { 1, 2, 3, 4, 5, 6, 7, 8,
          9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
          21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
          33, 34, 35, 36, 37, 38, 39, 40 };
      int second[MAXINTEGER] = { 40, 39, 38, 37, 36, 35,
          34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23,
          22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11,
          10, 9, 8, 7, 6, 5, 4, 3, 2, 1 };
      int zero[MAXINTEGER] = { 0 };
  
      //create objects
      HugeInteger myHugeInteger0;
      HugeInteger myHugeInteger1;
      HugeInteger myHugeInteger2;
      HugeInteger myHugeInteger3;
  
      //input arrays into objects
      myHugeInteger1.input(first);
      myHugeInteger2.input(second);
      myHugeInteger0.input(zero);
  
      //prints out the words true or false instead of a 1 or 0
      cout &lt;&lt; boolalpha &lt;&lt; endl;
  
      //opening statements
      cout &lt;&lt; "Welcome!\n" &lt;&lt; endl;
      cout &lt;&lt; "We will be testing a bunch of different functions on class objects today.\n" &lt;&lt; endl;
      cout &lt;&lt; "I have created three class objects which are 40 element arrays.\n" &lt;&lt; endl;
  
      system("pause");
      cout &lt;&lt; "\n" &lt;&lt; endl;
  
      //prints the elements in each object
      cout &lt;&lt; "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" &lt;&lt; endl;
      cout &lt;&lt; "My three objecs are: \n" &lt;&lt; endl;
      cout &lt;&lt; "myHugeInteger0:\n" &lt;&lt; endl;
      myHugeInteger0.output();
      cout &lt;&lt; "\n\nmyHugeInteger1:\n" &lt;&lt; endl;
      myHugeInteger1.output();
      cout &lt;&lt; "\n\nmyHugeInteger2:\n" &lt;&lt; endl;
      myHugeInteger2.output();
      cout &lt;&lt; "\n" &lt;&lt; endl;
  
      //intro to check if objecs are zero
      cout &lt;&lt; "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" &lt;&lt; endl;
      cout &lt;&lt; "First, we will test to see if all of the elements in the arrays are equal to \nzero.\n" &lt;&lt; endl;
  
      system("pause");
      cout &lt;&lt; endl;
  
      //test if the all of the object elements are equal to zero
      cout &lt;&lt; "Are all of the elements in myHugeInteger0 equal to zero?\n\n";
      cout &lt;&lt; myHugeInteger0.isZero() &lt;&lt; endl &lt;&lt; endl;
  
      cout &lt;&lt; "Are all of the elements in myHugeInteger1 equal to zero?\n\n";
      cout &lt;&lt; myHugeInteger1.isZero() &lt;&lt; endl &lt;&lt; endl;
  
      cout &lt;&lt; "Are all of the elements in myHugeInteger2 equal to zero?\n\n";
      cout &lt;&lt; myHugeInteger2.isZero() &lt;&lt; endl &lt;&lt; endl;
  
      //intro to adding the objects
      cout &lt;&lt; "\n\n" &lt;&lt; endl;
      cout &lt;&lt; "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" &lt;&lt; endl;
      cout &lt;&lt; "Now we shall add the different arrays together.\n" &lt;&lt; endl;
  
      system("pause");
      cout &lt;&lt; endl;
  
      //add the different objects
      myHugeInteger3 = myHugeInteger0.add(myHugeInteger1);
      cout &lt;&lt; "\nThe sum of myHugeInteger0 plus myHugeInteger1 equals\n\n";
      myHugeInteger3.output();
      cout &lt;&lt; endl;
  
      myHugeInteger3 = myHugeInteger0.add(myHugeInteger2);
      cout &lt;&lt; "\nThe sum of myHugeInteger0 plus myHugeInteger2 equals\n\n";
      myHugeInteger3.output();
      cout &lt;&lt; endl;
  
      myHugeInteger3 = myHugeInteger1.add(myHugeInteger2);
      cout &lt;&lt; "\nThe sum of myHugeInteger1 plus myHugeInteger2 equals\n\n";
      myHugeInteger3.output();
  
      //intro to subtracting the objects
      cout &lt;&lt; "\n\n" &lt;&lt; endl;
      cout &lt;&lt; "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" &lt;&lt; endl;
      cout &lt;&lt; "Now we shall subtract the different arrays.\n" &lt;&lt; endl;
  
      system("pause");
  
      //subtract the different objects
      myHugeInteger3 = myHugeInteger0.subtract(myHugeInteger1);
      cout &lt;&lt; "\nThe difference of myHugeInteger0 minus myHugeInteger1 equals\n\n";
      myHugeInteger3.output();
      cout &lt;&lt; endl;
  
      myHugeInteger3 = myHugeInteger1.subtract(myHugeInteger0);
      cout &lt;&lt; "\nThe difference of myHugeInteger1 minus myHugeInteger0 equals\n\n";
      myHugeInteger3.output();
      cout &lt;&lt; endl;
  
      myHugeInteger3 = myHugeInteger0.subtract(myHugeInteger2);
      cout &lt;&lt; "\nThe difference of myHugeInteger0 minus myHugeInteger2 equals\n\n";
      myHugeInteger3.output();
      cout &lt;&lt; endl;
  
      myHugeInteger3 = myHugeInteger2.subtract(myHugeInteger0);
      cout &lt;&lt; "\nThe difference of myHugeInteger2 minus myHugeInteger0 equals\n\n";
      myHugeInteger3.output();
      cout &lt;&lt; endl;
  
      myHugeInteger3 = myHugeInteger1.subtract(myHugeInteger2);
      cout &lt;&lt; "\nThe difference of myHugeInteger1 minus myHugeInteger2 equals\n\n";
      myHugeInteger3.output();
      cout &lt;&lt; endl;
  
      myHugeInteger3 = myHugeInteger2.subtract(myHugeInteger1);
      cout &lt;&lt; "\nThe difference of myHugeInteger2 minus myHugeInteger1 equals\n\n";
      myHugeInteger3.output();
      cout &lt;&lt; endl;
  
      //intro to multipling the objects
      cout &lt;&lt; "\n\n" &lt;&lt; endl;
      cout &lt;&lt; "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" &lt;&lt; endl;
      cout &lt;&lt; "Now we shall multiply the different arrays together.\n" &lt;&lt; endl;
  
      system("pause");
  
      //multiply the different objects
      myHugeInteger3 = myHugeInteger0.multiply(myHugeInteger1);
      cout &lt;&lt; "\nThe product of myHugeInteger0 times myHugeInteger1 equals\n\n";
      myHugeInteger3.output();
      cout &lt;&lt; endl;
  
      myHugeInteger3 = myHugeInteger0.multiply(myHugeInteger2);
      cout &lt;&lt; "\nThe product of myHugeInteger0 times myHugeInteger2 equals\n\n";
      myHugeInteger3.output();
      cout &lt;&lt; endl;
  
      myHugeInteger3 = myHugeInteger1.multiply(myHugeInteger2);
      cout &lt;&lt; "\nThe product of myHugeInteger1 times myHugeInteger2 equals\n\n";
      myHugeInteger3.output();
      cout &lt;&lt; endl;
  
      //intro to dividing the objects
      cout &lt;&lt; "\n\n" &lt;&lt; endl;
      cout &lt;&lt; "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" &lt;&lt; endl;
      cout &lt;&lt; "Now we shall divide the different arrays.\n" &lt;&lt; endl;
  
      system("pause");
  
      //divide the different objects
      myHugeInteger3 = myHugeInteger0.divide(myHugeInteger1);
      cout &lt;&lt; "\nThe dividen of myHugeInteger0 divided by myHugeInteger1 equals\n\n";
      myHugeInteger3.output();
      cout &lt;&lt; endl;
  
      myHugeInteger3 = myHugeInteger0.divide(myHugeInteger2);
      cout &lt;&lt; "\nThe dividen of myHugeInteger0 divided by myHugeInteger2 equals\n\n";
      myHugeInteger3.output();
      cout &lt;&lt; endl;
  
      myHugeInteger3 = myHugeInteger1.divide(myHugeInteger2);
      cout &lt;&lt; "\nThe dividen of myHugeInteger1 divided by myHugeInteger2 equals\n\n";
      myHugeInteger3.output();
      cout &lt;&lt; endl;
  
      myHugeInteger3 = myHugeInteger2.divide(myHugeInteger1);
      cout &lt;&lt; "\nThe dividen of myHugeInteger2 divided by myHugeInteger1 equals\n\n";
      myHugeInteger3.output();
      cout &lt;&lt; endl;
  
      //intro to comparing objects
      cout &lt;&lt; "\n\n" &lt;&lt; endl;
      cout &lt;&lt; "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" &lt;&lt; endl;
      cout &lt;&lt; "Now we shall compare the different arrays.\n" &lt;&lt; endl;
  
      system("pause");
      cout &lt;&lt; endl;
  
      //see if the objecs are equal
      cout &lt;&lt; "Is myHugeInteger0 equal to myHugeInteger1? \n\n";
      cout &lt;&lt; myHugeInteger0.isEqual(myHugeInteger1) &lt;&lt; endl &lt;&lt; endl;
      cout &lt;&lt; "Is myHugeInteger0 equal to myHugeInteger2? \n\n";
      cout &lt;&lt; myHugeInteger0.isEqual(myHugeInteger2) &lt;&lt; endl &lt;&lt; endl;
      cout &lt;&lt; "Is myHugeInteger1 equal to myHugeInteger2? \n\n";
      cout &lt;&lt; myHugeInteger1.isEqual(myHugeInteger2) &lt;&lt; endl &lt;&lt; endl;
  
      //see if the objects are not equal
      cout &lt;&lt; "Is myHugeInteger0 not equal to myHugeInteger1? \n\n";
      cout &lt;&lt; myHugeInteger0.isNotEqual(myHugeInteger1) &lt;&lt; endl &lt;&lt; endl;
      cout &lt;&lt; "Is myHugeInteger0 not equal to myHugeInteger2? \n\n";
      cout &lt;&lt; myHugeInteger0.isNotEqual(myHugeInteger2) &lt;&lt; endl &lt;&lt; endl;
      cout &lt;&lt; "Is myHugeInteger1 not equal to myHugeInteger2? \n\n";
      cout &lt;&lt; myHugeInteger1.isNotEqual(myHugeInteger2) &lt;&lt; endl &lt;&lt; endl;
  
      //see if the objects are greater than
  
      cout &lt;&lt; "\nThat is all for today! Thank you for watching!\n" &lt;&lt; endl;
      system("pause");
      return 0;
  }
  </code></pre>
  
  <p>Every time I run my program when it goes to compare the two objects it returns true no matter what. I can not figure out what I am doing wrong or how to fix it. Any help is greatly appreciated! Thank You!</p>