Using the code below i can't seem to figure out why i have a Null character in the input queue and therefore unable to use the cin.getline() for the name input.

I know if i uncomment the cin.get() it will work, but the question is... Why do i need it? Also if the Pizza::name is inputted first, before the diameter and weight it will work, anybody know what causes this problem?

BTW rock on, first post!

Code:
#include <iostream>
#include <cstring>
using namespace std;

struct pizza
{
char name[20];
float diameter;
float weight;
};

int main()
{
	pizza *ptr = new pizza;

	cout << "Enter the pizza diameter: ";
	cin >> ptr->diameter;

	cout << "Enter the pizza weight: ";
	cin >> ptr->weight;

	//cin.get();  // this is required to capture the rogue null char from the input queue

	cout << "Enter the pizza company name: ";
	cin.getline(ptr->name,20);

	cout << endl 
		<< "Name:     " << ptr->name << endl
		<< "Diameter: " << ptr->diameter << endl
		<< "Weight:   " << (*ptr).weight << endl;   

cout << "\n\n\n\n";
system("pause");
return 0;
}