Can you take a look at my work below and post your thoughts? I am new to C++ and the assignment is to open a data file with employee info and run a payroll system.I am stumped. The output is simply "press any key to continue"
#include<iostream>
#include<fstream>
using namespace std;
int main() {
int numberofemployees;
int counter;
int employeeid,employee;
int hoursworked;
float hourlyrate, grosspay, taxamount, netpay;
float const TAXRATE = .3;
cout<< "YOUR ID IS " <<employeeid<<endl;
cout<< "YOUR HOURS WORKED IS " <<hoursworked<<endl;
cout<< "YOUR HOURLY RATE IS " <<hourlyrate<<endl;
cout<< "YOUR GROSS PAY IS " <<grosspay<<endl;
cout<< "YOUR TAX RATE IS " <<TAXRATE<<endl;
cout<< "YOUR TAX AMOUNT IS " <<taxamount<<endl;
cout<< "YOUR NET PAY IS " <<netpay<<endl;
fin.close();
}//WHILE
system ("pause");
is the file really there, is it made out of numbers, are you sure there are no errors opening it?
also, your close() is inside while loop and it shouldn't.