#include<iostream>
#include<string>
usingnamespace std;
#define n_employee 5
struct database {
char name[30];
short age;
int salary;
} employee[n_employee];
void printdb (database);
int main() {
int n;
for (n=0;n<n_employee;n++) {
cout<<"name: "<<endl;
cin.getline(employee[n].name,30);
cout<<endl;
cout<<"age: "<<endl;
cin>>employee[n].age;
cout<<endl;
cout<<"salary: "<<endl;
cin>>employee[n].salary;
cout<<endl;
}
for (n=0;n<n_employee;n++) {
printdb(employee[n]);
}
return 0;
}
void printdb(database employee)
{
cout<<employee.name<<"\t";
cout<<employee.age<<"\t";
cout<<employee.salary<<endl;
}
the problem is for the first case (employee[0]) i am asked for name input.But after this (employee[1],employee[2]) i am not asked for name input but jumps to input for age and salary...please help