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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
int main()
{
ifstream in;
ofstream outPut;
int newI = 0;
Employee emp[20];
//case '1':
{
in.open("test.txt");
int i=0;
int id, d1, d2, d3, d4, d5;
float wage, ded;
string name;
if(in.is_open())
{
while((!in.eof()))
{
in>>id>>name>>d1>>d2>>d3>>d4>>d5>>wage>>ded;
emp[i].setData(id,name,d1,d2,d3,d4,d5,wage,ded);
emp[i].getData();
i++;
newI = i;
}
cout<<endl;
in.close();
}
else
{
cout<<"\n Unable to open file."<<endl<<endl;
}
}
//break;
//case '7':
{
outPut.open("outputFile.txt");
{
if(outPut.is_open())
{
for(int j=0; j<newI; j++)
{
outPut<<emp[j].printPayroll();
}
}
else
cout<<"Nope!";
outPut.close();
}
}
//break;
return 0;
}
|