1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
#include<iostream>
#include<fstream>
#include<iomanip>
using namespace std;
int main()
{
ofstream outfile;
ifstream infile;
string input[6];
infile.open("personnel.txt", ios::in);
if (infile.is_open())
{
getline(infile, input[0], ' ');
getline(infile, input[1], ' ');
getline(infile, input[2], ' ');
getline(infile, input[3], ' ');
getline(infile, input[4], ' ');
getline(infile, input[5], ' ');
getline(infile, input[6], ' ');
cout<<"\n\nLast Name: "<<input[0]<<"\nFirst Name: "<<input[1]<<"\nWorker ID: "<< input[2]<<"\nWorked Hour: "
<<input[3]<<"\nPay Rate "<< input[4]<<"\nTax Rate: "<<input[5]<<"\nNet Pay: "<< input[6]<< endl;
}
else
{
cout << "ERROR: Cannot open file.\n";
}
infile.close();
return 0;
}
|