#include <iostream>
#include <fstream>
using namespace std;
int main() {
int numberofemployees;
int employeeid, hoursworked;
float hourlyrate, grosspay, taxamount, netpay;
const float TAXRATE=0.10;
ifstream fin("C:\Dev-CPP\employee.txt");
while (!fin.eof() )}
fin >> employeeid >> hoursworked >> hourlyrate;
cout<<"EMPLOYEE ID IS: "<<employeeid<<endl;
cout<<"THE HOURS WORKED ARE: "<<hoursworked<<endl;
cout<<"THE HOURLY RATE IS: "<<hourlyrate<<endl;
grosspay=hoursworked*hourlyrate;
taxamount=grosspay*TAXRATE;
netpay=grosspay-taxamount;
cout<<"THE GROSSPAY IS"<<grosspay<<endl;
cout<<"THE TAX AMOUNT IS"<<taxamount<<endl;
cout<<"THE NETPAY IS"<<netpay<<endl;
}
fin.close ();
// system("pause");
return 0;
}//MAIN
- Using Bloodshed Dev C++ -
The name of the project sourcefile is payollin.cpp and document employee.txt
are in same folder (C:\Dev-Cpp).