Can't read program output
<p>So I'm learning C++ today and I've come across a little problem that I can't seem to solve. When I write a program to input information from a user, the program closes right after the user inputs the information and does not display the inputed information. </p>

<p>So for example, here's the code: </p>

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

using namespace std;

int main() {
    //Declar vairables
    char letter = 'A';
    int integer = 0;
    float dec = 0.0f;

    cout &lt;&lt; "Enter a letter: ";
    cin &gt;&gt; letter;

    cout &lt;&lt; "Enter an integer: ";
    cin &gt;&gt; integer;

    cout &lt;&lt; "Enter a float number: ";
    cin &gt;&gt; dec;

    cout &lt;&lt; endl;

    //Output what user entered
    cout &lt;&lt; "letter: " &lt;&lt; letter &lt;&lt; endl;
    cout &lt;&lt; "integer: " &lt;&lt; integer &lt;&lt; endl;
    cout &lt;&lt; "float number: " &lt;&lt; dec &lt;&lt; endl;
}
</code></pre>

<p>Now when I run this, the console asks me to: </p>

<ol>
<li>Input a letter</li>
<li>Input an integer</li>
<li>Input a float number</li>
</ol>

<p>After this though, the program instantly closes without displaying the output that this segment of code is supposed to do:</p>

<pre><code>//Output what user entered
cout &lt;&lt; "letter: " &lt;&lt; letter &lt;&lt; endl;
cout &lt;&lt; "integer: " &lt;&lt; integer &lt;&lt; endl;
cout &lt;&lt; "float number: " &lt;&lt; dec &lt;&lt; endl; }
</code></pre>

<p>This has me scratching my head as there are no compiling errors, and the code is ripped straight out of <em>C++ Programming for Games</em> by eInstitute Publishing. </p>
