How can I write this program?
<p>My task is to write the main function which defines an array of objects called <em>recs[]</em> with the size of 4. Each element of <code>recs</code> must be initialized with width and length, and I have to calculate its area and circumference.</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;cmath&gt;
using namespace std;

struct recs
{
    double width;
    double length;
};

class rect
{
    public:
           rect();
           double area; 
           double circumference;
           void setrect();
           void calarea();
           void calcircumf();
           void print(); 
           friend bool operator==(rect rec1,rect rec2);
    private:
            double width,length;
            };
            rect recs[4];

bool operator==(rect rec1,rect rec2)
{
     return (rec1.area == rec1.area &amp;&amp; rec1.circumference == rec2.circumference);
}

rect::rect()
{
    width=0.0;
    length=0.0;
}

void rect::setrect()
{
     cout &lt;&lt; "width = ";
     cin &gt;&gt; width;
     cout &lt;&lt; "length = ";
     cin &gt;&gt; length;
     print();
}

void rect::calarea()
{
     width == length;
     cout &lt;&lt; "the return value true" &lt;&lt; endl;
}

void rect::calcircumf()
{
     width == length;
     cout &lt;&lt; "the return value true" &lt;&lt; endl;
}

void rect::print()
{
     cout &lt;&lt; "width = " &lt;&lt; width &lt;&lt; endl;
     cout &lt;&lt; "length = " &lt;&lt; length &lt;&lt; endl &lt;&lt; endl;
     }

int main()
{   
    double area;
    double circumference;
    double width;
    double length;

    rect recs[4] = { {10.0, 12.0}, {12.0, 14.0}, {14.0, 16.0}, {16.0, 18.0} };

    for (int i = 0; i &lt;= 4; i++)
    {
        area = width * length;
        cout &lt;&lt; "the area "&lt;&lt; i &lt;&lt; " = " &lt;&lt; area &lt;&lt; endl ;

        circumference = ((width + length) + (width + length));
        cout &lt;&lt; "the circumference" &lt;&lt; i &lt;&lt; " = " &lt;&lt; circumference &lt;&lt; endl;

    };

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

<p>I've been editing this code for 4 hours so far, but I couldn't get it to compile.</p>
