#include <iostream>
#include <fstream>
#include <string>
usingnamespace std;
int main()
{
constint numEmployee = 5;
string Employees[numEmployee][3];
double payInformation[numEmployee][2];
char eStatus[numEmployee];
double overTimePay, regularPay, netPay;
ifstream fin("data.txt");
if (fin.fail())//Check if the file is open
{
cout << "File not opened..." << endl;
return 1;
}
while (!fin.eof())
{
if (!fin.eof())
{
int index;
index = 0;
fin >> Employees[index][0]
>> Employees[index][1]
>> Employees[index][2]
>> payInformation[index][0]
>> payInformation[index][1]
>> eStatus[index];
index++;
}
}
cout << Employees[0][0] << Employees[0][1]<< endl;
fin.close();
system ("PAUSE");
return 0;
}
When I print [0][0] I get the first name of all the employees instead of only the first one. My counter doesn't seem to be working. Thanks in advance for any advice.