Ok here it is. I have a simple program set up to prompt for the Employee name, id and pay. I have set up employee as a structure with three parts. My problem is with the get line that reads in the name. It works fine for the first Employee, but stores garbage in the variables and exits the program in the second two. Does anyone know how to stop it???
cout << "EMPLOYEE 1" << endl << "---------" << endl;
cout << "Enter Employee's name then hit Return TWICE: ";
getline(cin, Employee1.Name, '\n');
cout << "Enter the Employee's ID: ";
cin >> Employee1.ID;
cout << endl;
cout << "Enter the Employee's pay (in dollars): ";
cin >> Employee1.Pay;
cout << endl << endl;
cout << "EMPLOYEE 2" << endl << "---------" << endl;
cout << "Enter Employee's name then hit Return TWICE: ";
getline(cin, Employee2.Name);
cout << "Enter the Employee's ID: ";
cin >> Employee2.ID;
cout << endl << endl;
cout << "Enter the Employee's pay (in dollars): ";
cin >> Employee2.Pay;
cout << endl << endl;
cout << "EMPLOYEE 3" << endl << "---------" << endl;
cout << "Enter Employee's name then hit Return TWICE: ";
getline(cin, Employee3.Name, '\n');
cout << "Enter the Employee's ID: ";
cin >> Employee3.ID;
cout << endl << endl;
cout << "Enter the Employee's pay (in dollars): ";
cin >> Employee3.Pay;
cout << endl << endl;
HELP!!!
cout << "EMPLOYEE 1" << endl << "---------" << endl;
cout << "Enter Employee's name then hit Return TWICE: ";
getline(cin, Employee1.Name, '\n');
cout << "Enter the Employee's ID: ";
cin >> Employee1.ID;
cout << endl;
cout << "Enter the Employee's pay (in dollars): ";
cin >> Employee1.Pay;
cout << endl << endl;
cout << "EMPLOYEE 2" << endl << "---------" << endl;
cout << "Enter Employee's name then hit Return TWICE: ";
getline(cin, Employee2.Name);
cout << "Enter the Employee's ID: ";
cin >> Employee2.ID;
cout << endl << endl;
cout << "Enter the Employee's pay (in dollars): ";
cin >> Employee2.Pay;
cout << endl << endl;
cout << "EMPLOYEE 3" << endl << "---------" << endl;
cout << "Enter Employee's name then hit Return TWICE: ";
getline(cin, Employee3.Name, '\n');
cout << "Enter the Employee's ID: ";
cin >> Employee3.ID;
cout << endl << endl;
cout << "Enter the Employee's pay (in dollars): ";
cin >> Employee3.Pay;
cout << endl << endl;
HELP!!!