Question
Hi, Please see my code below I managed to get this far but not sure why am I not getting the right file created. I
Hi,
Please see my code below I managed to get this far but not sure why am I not getting the right file created. I created a .txt file and when I actually find the output thisWeekGrossPay.txt file it shows 000000 . basically the question is to create a file under myEmployee.txt that would show this;
Daniel Consuegra 9.50 40 Kamal Salomon 15 43 Patricia Gonzalez 13 41 Antonio Suarez 11 48 Valerie Diaz 23 45
I run program it comes 0 code error, the idea is that the output shows names and weekly gross pay in output. Please help.
#include
#include
#include
#include
using namespace std;
int main()
{
ifstream inFile;
ofstream outFile;
double payRate, hoursWorked;
double grossPay;
string firstName;
string lastName;
inFile.open("myEmployee.txt");
outFile.open("thisWeekGrossPay.txt");
cout< //First Employee inFile>>lastName>>firstName>>payRate>>hoursWorked; grossPay = payRate * hoursWorked; outFile<< firstName<< " "<< lastName<< " "<< grossPay<< endl; //Second Employee inFile>>lastName>>firstName>>payRate>>hoursWorked; grossPay = payRate * hoursWorked; outFile<< firstName<< " "<< lastName<< " "<< grossPay<< endl; //Third Employee inFile>>lastName>>firstName>>payRate>>hoursWorked; grossPay = payRate * hoursWorked; outFile<< firstName<< " "<< lastName<< " "<< grossPay<< endl; //Fourth Employee inFile>>lastName>>firstName>>payRate>>hoursWorked; grossPay = payRate * hoursWorked; outFile<< firstName<< " "<< lastName<< " "<< grossPay<< endl; //Fifth Employee inFile>>lastName>>firstName>>payRate>>hoursWorked; grossPay = payRate * hoursWorked; outFile<< firstName<< " "<< lastName<< " "<< grossPay<< endl; inFile.close(); outFile.close(); system("PAUSE"); return 0; }
Step 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