I'm trying to add variables by users input using >> or getline but it is giving null values with both of them .As we know getline does not ignore leading whitespace characters that's why i'm using string whitespaces like employeeName=" "; string designation=" ";.
Can anyone help me for getting proper output
class Employee{
  public:
  int employeeId,salary;
  string employeeName=" ";
  string designation=" ";
  void getEmployee(){
    cin>>employeeId;
    getline(cin,employeeName);
    getline(cin,designation);
    cin>>salary;
  }
  void ShowEmployee(){
    cout<<"Employee Id="<<employeeId<<"\n";
    cout<<"Employee Name="<<employeeName<<"\n";
    cout<<"Designation="<<designation<<"\n";
    cout<<"Salary="<<salary<<"\n";
  }
};
int main() {
  Employee ob;
  ob.getEmployee();
  ob.ShowEmployee();
}

 
     
     
    