title: Mixed data typeinput in C++
body: <p>Why does this program run fine?</p>
  
  <pre><code>#include&lt;iostream&gt;
  using namespace std;
  int main()
  {
      cout &lt;&lt;"What year was your house built?\n";
      int year;
      cin &gt;&gt; year;
      cout &lt;&lt; "What is its street address?\n";
      char address[80];
      cin&gt;&gt;address;
      cout &lt;&lt; "Year built: " &lt;&lt; year &lt;&lt; endl;
      cout &lt;&lt; "Address: " &lt;&lt; address &lt;&lt; endl;
      cout &lt;&lt; "Done!\n";
      return 0;
  }
  </code></pre>
  
  <p>And why does this program  not give the chance to enter the address?</p>
  
  <pre><code>#include &lt;iostream&gt;
  int main()
  {
      using namespace std;
      cout &lt;&lt;"What year was your house built?\n";
      int year;
      cin &gt;&gt; year;
      cout &lt;&lt; "What is its street address?\n";
      char address[80];
      cin.getline(address, 80);
      cout &lt;&lt; "Year built: " &lt;&lt; year &lt;&lt; endl;
      cout &lt;&lt; "Address: " &lt;&lt; address &lt;&lt; endl;
      cout &lt;&lt; "Done!\n";
      return 0;
  }
  </code></pre>