C++ program wont terminate : <p>I have created the following simple program designed to double a number if its in a list, and terminate if the entered number is not in the list.</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;array&gt;
using namespace std;
int main()
{
cout &lt;&lt; "First we will make a list" &lt;&lt; endl;

array &lt;int, 5&gt;list;
int x, number;
bool isinlist = true;

cout &lt;&lt; "Enter list of 5 numbers." &lt;&lt; endl;

for (x = 0; x &lt;= 4; x++)
{
    cin &gt;&gt; list[x];
}
while (isinlist = true)
{
    cout &lt;&lt; "now enter a number on the list to double" &lt;&lt; endl;
    cin &gt;&gt; number;

    for (x = 0; x &lt;= 4; x++)
    {
        if (number == list[x])
        {
            cout &lt;&lt; "The number is in the list. Double " &lt;&lt; number &lt;&lt; " is " &lt;&lt; number * 2 &lt;&lt; endl;
        }
        else
            isinlist = false;
    }
}
return 0; 
}
</code></pre>

<p>However when the program is running if a number is entered that is not on the list , the program continues to loop. How can I stop this from happening ?</p>
