title: How to skip a field without entering value in c++
body: <p>In the below code phone number is not mandatory. How can i skip the field? If i press enter it is still waiting for my input. I want to skip the phone number field if necessary. Is that possible in C++.</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  int main()
  { 
      string id, name, phone, dob;
      cout &lt;&lt; "Enter id";
      cin &gt;&gt; id;
      cout &lt;&lt; "Enter name";
      cin &gt;&gt; name;
      cout &lt;&lt; "Enter phone number";
      cin &gt;&gt; phone;
      cout &lt;&lt; "Enter date of birth";
      cin &gt;&gt; dob;
  }
  </code></pre>