Can't seem to get the correct output from my code block
<p>I was just wondering if anyone noticed i was doing something wrong with my code block. Ths program is supposed to be a test program that compares 2 dates. The function that im working on is supposed to return a 1 if the invoking date is greater, a -1 f the invoking date is less than, and a 0 if the invoking date is equal to the date in the parameter. My test Program :</p>

<pre><code>#include &lt;cstdlib&gt;
#include &lt;iostream&gt;
#include &lt;string&gt;

#include "date.h"

using namespace std;

//date is initialized in a month/day/year format.

int main(int argc, char* argv[])
{
    string* d;

    date d1(4,1,4);
    date d4(4,4,4);

    int greaterTest = d4.compareTo(d1);
    int lessTest = d1.compareTo(d4);


    cout &lt;&lt; greaterTest &lt;&lt; endl;               //i believe these two lines are printing out a
    cout &lt;&lt; lessTest &lt;&lt; endl;                  //location in memory
    cout&lt;&lt;&amp;d &lt;&lt;endl;


    system("pause");
    return EXIT_SUCCESS;
}
</code></pre>

<p>The huge compareTo() function :</p>

<pre><code>    int date::compareTo (date another_date)
{

    if (this-&gt;year == another_date.year &amp;&amp; this-&gt;month == month &amp;&amp; this-&gt;day &lt; another_date.day)    //if both year and month are the same, test to see if day is less
    {

        return -1;
    }

    else if (this-&gt;year == another_date.year &amp;&amp; this-&gt;month == month &amp;&amp; this-&gt;day &gt; another_date.day)   //if both year and month are the same, test to see if day is greater
    {

        return 1;
    }


    else if (this-&gt;year == another_date.year &amp;&amp; this-&gt;month &gt; month)                            //if the years are the same, test to see if the invoking month is greater
    {

        return 1;
    }

    else if (this-&gt;year == another_date.year &amp;&amp; this-&gt;month &lt; month)                            //if the years are the same, test to see if the invoking month is less
    {

        return -1;
    }


    else if (this-&gt;year &gt; another_date.year)                                                    //test to see if the invoking year is greater
    {

        return 1;
    }

    else if (this-&gt;year &lt; another_date.year)                                                    //test to see if the invoking year is less
    {

        return -1;
    }

    else if(this-&gt; year == another_date.year &amp;&amp; this-&gt; month == another_date.month                  //test if the dates are exactly the same
        &amp;&amp; this-&gt; day == another_date.day)
    {

        return 0;
    } 


    //else{ return 15;}                                                                             //if none are true, return 15


}
</code></pre>

<p>the only problem im getting is when i try to change the day (the second parameter for date).</p>
