title: String input in standard C++
body: <p>I want to take string input this C++ program but the following code doesn't work. It doesn't take the employee's name as input. It just skips. Sorry I am new to C++.</p>
  
  <pre><code>#include&lt;iostream&gt;
  #include&lt;string&gt;
  using namespace std;
  int main()
  {
    int empid;
    char name[50];
    float sal;
    cout&lt;&lt;"Enter the employee Id\n";
    cin&gt;&gt;empid;
    cout&lt;&lt;"Enter the Employee's name\n";
    cin.getline(name,50);
    cout&lt;&lt;"Enter the salary\n";
    cin&gt;&gt;sal;
    cout&lt;&lt;"Employee Details:"&lt;&lt;endl;
    cout&lt;&lt;"ID : "&lt;&lt;empid&lt;&lt;endl;
    cout&lt;&lt;"Name : "&lt;&lt;name&lt;&lt;endl;
    cout&lt;&lt;"Salary : "&lt;&lt;sal;
    return 0;
  }
  </code></pre>