Receiving integers, but also want to test for char
<p>Say I am looking to receive a series of numeric values and read them into an int, but I also want to test if the user hit key 'x'.</p>

<p>I am sure I am missing something obvious, and have tried a few things but seem to be stuck.</p>

<p>This is what I have so far...
    <code><br>
    cout &lt;&lt; endl &lt;&lt; "Enter key (or 'x' to exit): ";<br>
    cin >> key;<br>
    if (key == 'x') { cout &lt;&lt; "exiting";}<br>
    // continue on...
    </code>  </p>
