Problem with inputing the char type

When i have two chars to input, the first char is exepted.
Example:

#include <iostream>
#include <string>
using namespace std;

struct text
{
char first[10];
char second[10];
};

text t[10];
int i, n;

void enter()
{
do{cout<<"n=";cin>>n;}
while(n<1 || n>10);

for(int i=0;i<n;i++)
{
cout<<"first name: ";cin.getline(t[i].first, 10);
cout<<"second name: ";cin.getline(t[i].second, 10);
cout<<endl;
}
}

int main()
{
enter();

system("pause");
return true;
}

output:
first:second:........("name")
press any key to continue.

I want to know how to add and the first char.




Topic archived. No new replies allowed.