Here you go ...
As far as I know (and I definitely don't know everything) getline() only accepts an input stream as the first parameter and a string to store the entered value as the second parameter.
I changed your definition of name and address for char[xx] to strings, the parameters you passed to getline(), a little tidying up on the output text, and added a cin.ignore(); after you input the integer.
I am not entirely sure why this is needed, but I have run into it before. Would love to get feedback from someone that knows more. The way I understand it is ...
You entered an integer, so the \n remains in the stream and then gets picked up by the next request for input. I normally input everything as strings and then convert/check/reject input as needed before I use it.
stringstream has some interesting functions for this purpose. Also, boost has some conversion functions that are very handy.
Hope this helps ...
#include <iostream>
#include <string>
using namespace std;
class employee
{
private:
int salary;
string name, address;
public:
int empno;
void input(void);
void output(void);
};
void employee::input(void)
{
cout << "\n Employee Number: ";
cin >> empno;
cin.ignore();
cout << "\n Enter Name: ";
getline(cin, name);
cout << "\n Enter Address: ";
getline(cin, address);
cout << "\n Enter Salary: ";
cin >> salary;
}
void employee::output(void)
{
cout << "\n\n Name is: " << name;
cout << "\n Address is: " << address;
cout << "\n Salary is: " << salary;
}
int main()
{
employee emp;
emp.input();
emp.output();
}