again
is declared as a single char value, so the ENTER that terminated it is still in the input buffer.
I'd write a simple method:
void EmptyBuffer()
{
cin.ignore(numeric_limits<streamsize>::max(), '\n');
}
And call it before each prompt:
EmptyBuffer();
std::cout << "\nPlease Enter your name:";
std::cin.getline(p.name, MAX_LENGTH);
EmptyBuffer();
std::cout << "\nPlease Enter your age:";
std::cin >> p.age;
...
EmptyBuffer();
std::cout << "\tDo you want to input another data?(Y/N):";
cin >> again;
That way, anything left in the buffer is disposed of.