Ideas why this doesnt work?
Code:
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdlib>
bool getEmp(ifstream& empFile, string& lastName, string& firstName,
double& salary, double& raise);
void writeEmp(ofstream& newFile, string& firstName, string&lastName,
double& updatedSalary);
void calcSalary(double salary, double raise, double updatedSalary);
using namespace std;
int main()
{
cout << "Beginning employee salary updation.\n";
ifstream empFile ("Ch3_Ex8Data.txt");
if (!empFile) {
cerr << "The system was unable to open the file."; //error if file is in use.
exit(100); //if it is, terminate.
}
ofstream newFile ("Ch3_Ex8Output.dat")
if (!newFile) {
cerr << "They system was unable to open the file.";
exit (102);
}
string firstName, lastName;
double salary, raise, updatedSalary;
while (getEmp (empFile, lastName, firstName, salary, raise))
{
calcSalary (salary, raise, updatedSalary);
writeEmp (newFile, firstName, lastName, updatedSalary);
} //end of while
empfile.close();
newfile.close();
cout << "End of salary updation.\n";
return 0;
} //end of main
bool getEmp(ifstream& empFile, string& lastName, string& firstName,
double& salary, double& raise)
{
empFile >> lastName >> firstName >> salary >> raise;
if (!empFile)
return false;
return true;
} //end getEmp
void calcSalary(double salary, double raise, double updatedSalary)
{
updatedSalary = (((raise*.01)+1)*salary)
return;
} //end calcSalary
void writeEmp(ofstream& newFile, string& firstName, string&lastName,
double& updatedSalary)
{
newfile << firstName;
newfile.fill << (' ');
newfile << lastName;
newfile.fill (' ');
newfile << updatedSalary;
return;
} //end writeEmp