C++ Noobie - Why does moving these lines break my application?
<p>This is my first attempt at C++, following an example to calculate a tip through a console application. The full (working code) is shown below:</p>

<pre><code>// Week1.cpp : Defines the entry point for the console application.

#include "stdafx.h"
#include &lt;iostream&gt;
#include &lt;string&gt;
using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
    // Declare variables
    double totalBill = 0.0;
    double liquour = 0.0;
    double tipPercentage = 0.0;
    double totalNoLiquour = 0.0;
    double tip = 0.0;
    string hadLiquour;

    // Capture inputs
    cout &lt;&lt; "Did you drink any booze? (Yes or No)\t";
    getline(cin, hadLiquour, '\n');

    if(hadLiquour == "Yes") {
        cout &lt;&lt; "Please enter you booze bill\t";
        cin &gt;&gt; liquour;
    }

    cout &lt;&lt; "Please enter your total bill\t";
    cin &gt;&gt; totalBill;

    cout &lt;&lt; "Enter the tip percentage (in decimal form)\t";
    cin &gt;&gt; tipPercentage;

    // Process inputs
    totalNoLiquour = totalBill - liquour;
    tip = totalNoLiquour * tipPercentage;

    // Output
    cout &lt;&lt; "Tip: " &lt;&lt; (char)156 &lt;&lt; tip &lt;&lt; endl;
    system("pause");

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

<p>This works fine. However, I want to move:</p>

<pre><code>cout &lt;&lt; "Please enter your total bill\t";
cin &gt;&gt; totalBill;
</code></pre>

<p>to be the first line under:</p>

<pre><code> // Capture inputs
</code></pre>

<p>But when I do the application breaks (it compiles, but just ignores the if statement and then prints both cout's at once.</p>

<p>Im scratching my head becuase I cant understand what's going on - but I'm assuming I'm being an idiot!</p>

<p>Thanks</p>
