Here's the code:
#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;
const int MAX_EMPLOYEE = 500;
enum PayType{H, S};
struct EMPLOYEE
{
int idNumber;
char name[21];
double payRate;
short int numberDependents;
enum PayType;
};
int LoadMaster(EMPLOYEE& record);
int main(){
int count;
EMPLOYEE record;
count = LoadMaster(record);
cout << count;
return 0;
}
int LoadMaster( EMPLOYEE& record){
int count = 0;
ifstream infile("ASG069_master.txt");
if(!infile){
cout << "Data file could not be found!\n";
exit(1);
}
while(infile){
infile >> record.idNumber;
infile.get(record.name, sizeof(record.name));
infile >> record.payRate >> record.numberDependents >> record.PayType;
count++;
}
return count;
}
It's giving me an error with the "record.PayType"; The input file looks like this:
1234 Samuel Spade 15.5 2 H
The PayType represent either Hourly or Salaried - the H stands for Hourly while the S stands for Salaried. What am I doing wrong? The error message reads:
illegal as right side of '.' operator