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++.
#include<iostream>
#include<string>
using namespace std;
int main()
{
int empid;
char name[50];
float sal;
cout<<"Enter the employee Id\n";
cin>>empid;
cout<<"Enter the Employee's name\n";
cin.getline(name,50);
cout<<"Enter the salary\n";
cin>>sal;
cout<<"Employee Details:"<<endl;
cout<<"ID : "<<empid<<endl;
cout<<"Name : "<<name<<endl;
cout<<"Salary : "<<sal;
return 0;
}