Question
Programming Language: C++ This is what I have so far, but I get an error when it's time to check, Can't open the file... Note:
Programming Language: C++
This is what I have so far, but I get an error when it's time to check, "Can't open the file..."
Note: I changed the file name to StudentData.txt and the file is placed in the project folder.
int main() { std::ifstream inFile; std::ofstream outFile; double salary = 0; double percentage = 0; double updatedSalary = 0; char firstName[20]; char lastName[20];
inFile.open("StudentData.txt"); // 3. open file: must already in project folder if (inFile.fail()) // !!! 3.5 check if successful { std::cerr
std::cout
inFile >> lastName >> firstName >> salary >> percentage; updatedSalary = salary * (1 + (0.01 * percentage));
outFile
inFile >> lastName >> firstName >> salary >> percentage; updatedSalary = salary * (1 + (0.01 * percentage)); outFile
inFile >> lastName >> firstName >> salary >> percentage; updatedSalary = salary * (1 + (0.01 * percentage)); outFile
inFile.close(); outFile.close();
system("pause"); return 0; }
Three employees in a company are up for a special pay increase. You are given a file, say ch3_Bx5Data.txt, with the following data: Miller Andrew 65789.87 5 Green Sheila 75892.56 6 Sethi Amit 74900.50 6.1 5Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started