Hello everybody,

here is one of the function definition in my c++ program...
Unfortunately, it doesn't work...(It compile but it won't let me to enter the name.)

void ListMemberName(Member arr[], int length1)
//Purpose: List member by name
//Pass by Value: length1
//Pass by Reference: arr[]
{
char target[30];
int ctr=0;
int found = 0;

cout<<"Enter name of the member"<<endl;
cin.getline(target,30,'\n');

while ((ctr<length1)&&(found==0))
{
if (strcmp(target, arr[ctr].name)==0)
{
found=1;
cout<<arr[ctr].num<<' '<<arr[ctr].gend<<' '<<arr[ctr].name<<endl;
}
else
ctr++;
}
if (found==0)
cout<<"Invalid input"<<endl;
}

I'm pretty sure it is the line "cin.getline(target,30,'\n');" that cause the problem.
Since it required to enter a full name(have space), therefore i use cin.getline instead of cin>>.

Thanks