I have an asignment where i must read and then later do calculations with the data.
I need to
•Code for employee classification (H for hourly, S for salaried)
•If hourly, two fields follow: hours worked and hourly pay rate
•If salaried, only one field follows: annual salary
This is the data to be read:
101456 H 20 6.57
100045 S 81994.12
100321 H 45 23.50
101987 H 39 15.76
100486 S 116935.65
100357 H 50 18.19
102003 H 30 12.75
123887 S 226345.43
110441 S 54783.28
101119 H 35 22.22
114532 S 152573.23
100003 H 40 19.00
101285 H 60 29.95
105539 S 100284.54
176531 S 78546.77
101119 H 38 43.15
This is what I have but I can't seem to get it to work. Any help would be greatly appreciated .
You need brackets around your while loop, you should call inFile.good() in place of !inFile.eof(), you never read in the variable code. Read it in first, then check for its value.