I am getting the following errors on my code below. Any help would be appreciated.
69 expected primary-expression before '>>' token
71 `next' undeclared (first use this function)
86`Total' undeclared (first use this function)
86 expected `;' before "Gross"
#include <iostream>
#include <iomanip>
#include <string>
#include <fstream>
#include <cstdlib>
using namespace std;
int main()
{
float totalTax = 0; // declare total tax = 0
float totalGrossEarnings =0; // declare total gross earnings = 0
float totalMedicalLevy = 0; // declare total medical levy = 0
float totalEarnings =0; // declare total earnings =0
float taxPayable;
float netEarnings;
float medicalLevy;
float grossEarnings;
string employeeRecord[11];
int employeeNumber;
int hours=0;
int rate=0;
// declare input and output file streams
ifstream infile;
infile.open("earnings.txt", ios::in);
ofstream outfile;
outfile.open("data.txt", ios::out); // open the files for input and output
// set format manipulators
cout.setf(ios::fixed);
cout << setprecision(2);
outfile << setw(11)<< "employee Number" << setw(11)<<"gross Earnings" <<setw(11) << "tax Payable" << setw(11) <<"medical Levy" << setw (11) <<"net Earnings" <<endl;
// write to outfile
infile >>setw(11)>>employeeNumber>>setw(11)>>grossEarnings>>setw(11)>>taxPayable>>setw(11)
>>setw(11)>>netEarnings>>endl; // read from infile
while (infile>>next) // do more records
{
grossEarnings = (hours * rate);
taxPayable = grossEarnings * 0.15;
medicalLevy = grossEarnings * 0.01;
netEarnings = grossEarnings - taxPayable - medicalLevy;
totalGrossEarnings = totalGrossEarnings + grossEarnings;
totalTax = totalTax + taxPayable;
totalMedicalLevy = totalMedicalLevy + medicalLevy;
totalEarnings = totalEarnings + netEarnings;
}
while (infile>>next) // do more records
{
outfile << Total Gross Earnings
outfile << Total tax;
outfile << Total Medical Levy;
outfile << Total Net Earnings< endl;
}
infile.close() ;
outfile.close () ;
("PAUSE");
return 0;
}
}