Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Convert your solution to use a while loop to read your file. You need to use the eof() to terminate your loop. #include #include #include

Convert your solution to use a while loop to read your file. You need to use the eof() to terminate your loop.

#include #include #include #include using namespace std;

int main() { ifstream inData; ofstream outData; double salary = 0, percentage = 0; double updatedSalary; char fname [20], lname [20];

cout << "Program that read data from the file:" << "CH03_Ex05Data.txt Store the output in the" << "file: CH03_Ex05.cpp";

inData.open("Ch03_Ex05Data.txt"); outData.open("Ch03_Ex05.cpp");

cout << fixed << showpoint; cout << setprecision(2);

inData >> lname >> fname >> salary >> percentage; updatedSalary = salary * ( 1 + (0.01 * percentage));

outData << "fname" << " " << "lname" << " " << "updatedSalary" << endl; outData << fname << " " << lname << " " << updatedSalary << endl;

inData >> lname >> fname >> salary >> percentage;

updatedSalary = salary * (1 + (0.01 * percentage));

outData << fname << " " << lname << " " << updatedSalary << endl;

inData >> lname >> fname >> salary >> percentage; updatedSalary = salary * (1 + (0.01 * percentage));

outData << fname << " " << lname << " " << updatedSalary << endl;

inData.close(); outData.close(); cout << endl;

system("pause"); return 0; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

4th Edition

0805360476, 978-0805360479

More Books

Students also viewed these Databases questions

Question

Focus on three or four areas.

Answered: 1 week ago

Question

Question Can a Roth IRA invest in stock of the IRA owners business?

Answered: 1 week ago