LAB 4

LAB 4

//Lab____4
//Shah_Sajid
//A20EC4050
#include<iostream>
#include<fstream>
#include<string.h>
using namespace std;

int main()
{
double sales[100],sum;
int x=0;
float average;
string employee_id;

ifstream filein;
filein.open("inputfile.txt");

ofstream fileout;
fileout.open("outputfile.txt");

if(!filein)
{
cout<<"FILE NOT EXIST";
return 0;
}
while(!filein.eof())
{
filein>>employee_id>>sales[x];
if (sales[x]>=250)
{
fileout<<employee_id<<" "<<sales[x]<<" "<<"bonus"<<endl;
}
else
{
fileout<<employee_id<<" "<<sales[x]<<" "<<"Sorry! No BONOUS"<<endl;
}

sum+=sales[x];
x++;
}
average= sum/3;
fileout<<"\n AVERAGE IS = "<<average;
filein.close();
fileout.close();


return 0;
}