#include <iostream> #include <fstream> #include <iomanip> #include <string> usin
ID: 3612998 • Letter: #
Question
#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
using namespace std;
int main()
{
ifstream inFile;
ofstream outFile;
double currentSalary=0,updatedSalary, payIncrease=0;
string firstName;
string lastName;
inFile.open("h:\Ch3_Ex6Data.txt");
outFile.open("h:\Ch3_Ex6Output.txt");
cout<<fixed<<showpoint<<setprecision(2);
//First Employee
inFile>>lastName>>firstName>>currentSalary>>payIncrease;
updatedSalary = currentSalary *(1+(payIncrease*0.01));
outFile<< firstName<<""<< lastName<<""<< updatedSalary<<endl;
//Second Employee
inFile>>lastName>>firstName>>currentSalary>>payIncrease;
updatedSalary = currentSalary *(1+(payIncrease*0.01));
outFile<< firstName<<""<< lastName<<""<< updatedSalary<<endl;
//Third Employee
inFile>>lastName>>firstName>>currentSalary>>payIncrease;
updatedSalary = currentSalary *(1+(payIncrease*0.01));
outFile<< firstName<<""<< lastName<<""<< updatedSalary<<endl;
inFile.close();
outFile.close();
return 0;
Explanation / Answer
please rate - thanks I changed the input and output files to be in the same directory asthe source file. make sure you create the input fileCh3_Ex6Data.txt using a text editor, the output file will becreated automatically. #include #include #include #include using namespace std; int main() { ifstream inFile; ofstream outFile; double currentSalary=0, updatedSalary, payIncrease=0; string firstName; string lastName; inFile.open("Ch3_Ex6Data.txt"); outFile.open("Ch3_Ex6Output.txt"); coutcurrentSalary>>payIncrease; updatedSalary = currentSalary * (1+(payIncrease*0.01)); outFileRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.