Question: C++ Please add in a function in the given program that allows an filename input from the user, thank you. #include #include #include #include using
C++
Please add in a function in the given program that allows an filename input from the user, thank you.
#include
#include
#include
#include
using namespace std;
int main() {
ifstream inFile;
ofstream outFile;
double salary = 0, percentage = 0;
double updatedSalary;
char firstName[20];
char lastName[20];
inFile.open("Ch3_Ex5Data.txt");
outFile.open("Ch3_Ex5Output.dat");
outFile << setprecision(2) << showpoint << fixed;
while (!inFile.eof()) {
inFile >> lastName >> firstName >> salary >> percentage;
updatedSalary = salary * (1 + (0.01 * percentage));
outFile << firstName << "\t" << lastName << "\t" << updatedSalary << endl;
}
inFile.close();
outFile.close();
return 0;
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
