i was working on some code and ran into some trouble. the getline function seems to be getting the data incorrectly.

i tried the cin.ignore(1) to fix the problem with using getline and >> in the same program, which allowed me to provide the input to the getline functions, but it ignored the first letter of the first instance of getline. (it got 'ilac' instead of 'Lilac', but worked perfectly for the rest of them).

now, when it is reading from the data file, it correctly gets the first tape_name, show date, location, but then it misses the show_name.

the rest of the data is offset after that and doesn't fit into the outputs.

here's the code for the input data:
Code:
void inputdata()
{
	ofstream outfile;
	outfile.open("tapes2.dat", ios::app);
	assert(outfile);

	string tape_name_temp;
	int month=0;
	int day=0;
	int year=0;
	int hour=0;
	int minute=0;
	string show_name_temp;

	cout<<"Please input the tape name: ";
	cin.ignore(1);
	getline(cin, tape_name_temp);
	outfile<<tape_name_temp <<'\n';
	
	cout<<"Please input the date in mm dd yyyy format: ";
	cin>>month >>day >>year;
	outfile<<month <<'\n';
	outfile<<day <<'\n';
	outfile<<year <<'\n';

	cout<<"Please input the hour and minute of the show in hh mm format: ";
	cin>>hour >>minute;
	outfile<<hour <<'\n';
	outfile<<minute <<'\n';

	cout<<"Please input the title of the show: ";
	cin.ignore(1);
	getline(cin, show_name_temp);
	outfile<<show_name_temp <<'\n';

	outfile.close();
}
and then here is the output of the program after it has had some data entered into the file:

datafile is 3 places.
tape name: ilac
show date: 12 1 2003
location: 3:30
show name:
tape name: Grounded for life
show date: -858993460 -858993460 -858993460
location: -858993460:-858993460
show name:
tape name:
show date: -858993460 -858993460 -858993460
location: -858993460:-858993460
show name:
Please input the tape name:

and attached is the complete code if anyone wants to compile it