Hi guys, quick question for you.
for (i = 0; i < NUM_EMPS; i++)
{
cout << "First and Last Name: ";
cin.getline( names[i], 31 );
for (index = 0; index < NUM_MONTHS; index++)
{
cout << "Hours worked in ";
cout << months[index];
cout << ": ";
cin >> hours[i][index];
}
}
The first loop is supposed to prompt the user to enter a first and a last name. Then the second loop displays the name of a month, at which point the user inputs how may hours were worked that month. This is supposed to work for three different people. It works fine the first time through but when it comes time to enter the second name, it is skipped.
Sample Output:
First and Last Name: joe schmo
January: 1
Feb: 4
Mar: 6
Apr: 9
May: 12
June: 5
First and Last Name: January: <-------------
Feb:
Mar:
etc....
That arrow signifies where my issue is. Why is it skipping the input for name there? It doesn't pause at all?
Thanks for your time. I appreciate any help.