C++ "while" explanation
<p>i am not very sure the while(choice == 1 || choice ==2);
can anyone explain. i understand this </p>

<pre><code>if(choice ==1)
    displayMonthly(rainfall);
else if(choice == 2)
    displayTotal(rainfall);
</code></pre>

<p>i just don't understand the code after this. can anyone explain to me please.</p>

<pre><code>int main()
{
    //declare variable and array
    int choice = 0;
    double rainfall[12] = {0.0};

    //get rainfall amounts
    for(int x =0;x&lt;12;x++)
    {
        cout &lt;&lt; "Enter rainfall for month "&lt;&lt; x+1&lt;&lt; ": ";
        cin &gt;&gt; rainfall[x];
    }

    do
    {
        //display menu and get menu choice
        cout &lt;&lt;endl;
        cout &lt;&lt; "1  Display monthly amounts" &lt;&lt; endl;
        cout &lt;&lt; "2  Display total amount" &lt;&lt; endl;
        cout &lt;&lt; "3  End program" &lt;&lt; endl;
        cout &lt;&lt; "Enter your choice : ";
        cin &gt;&gt; choice;

        //call appropriate function or end program
        if(choice ==1)
            displayMonthly(rainfall);
        else if(choice == 2)
            displayTotal(rainfall);
    }while (choice == 1 || choice ==2);

    return 0;
}
</code></pre>
