Hey guys I have a quick question. I am trying to print from a database within a struct. I need it to hold information for five employees hence the MAX being five. However I am trying to test it for just one employee because there is just simply a lot of data to enter. Once the data is entered it does not print any of the entered data and the formatting is all off. Any ideas? Thanks!
Code:
#include <iostream>
int id_Num;
int hours;
float gross;
};
employeeType Database[MAX];
int main()
{
int i;
for (i = 1; i < 2; i++)
{
cout << "Please enter information for employee number " << i << ": " << endl;
cin >> Database[i].id_Num >> Database[i].employee.last >> Database[i].employee.first >> Database[i].employee.mid
>> Database[i].dob.day >> Database[i].dob.month >> Database[i].dob.year >> Database[i].rate >> Database[i].hours
>> Database[i].starting.day >> Database[i].starting.month >> Database[i].starting.year
>> Database[i].supervisor.last >> Database[i].supervisor.first >> Database[i].supervisor.mid;
Database[i].gross = (float)(Database[i].hours * Database[i].rate);
}
int j;
cout << "Number Name(last, first, middle) DOB Rate Hours GrossPay StartingDate Supervisor(last, first, middle)";
for (j = 1; j <2; j++)
{
cout << Database[i].id_Num << " " << Database[i].employee.last << " " << Database[i].employee.first
<< " " << Database[i].employee.mid << " " << Database[i].dob.day << "-" << Database[i].dob.month
<< "-" << Database[i].dob.year << " " << Database[i].rate << " " << Database[i].hours << " "
<< Database[i].gross << " "
<< Database[i].starting.day << "-" << Database[i].starting.month << "-" << Database[i].starting.year << " "
<< Database[i].supervisor.last << " " << Database[i].supervisor.first << " " << Database[i].supervisor.mid;
}
return 0;
}