You are the manager of a travel agency with 20 employees. You have announced a promotional
campaign for your agents to sell vacation packages. Each day you will enter the ID number of the agent (#1-#20), the number of packages sold, and the dollar value of the package. Entries will be in a random order and the total $ value is accumulated for a 3 week period. At the end of the campaign you want a print out of those agents who sold less than $1000.00 in the 3 week time frame. You will also want a list of those that did not participate in the campaign.
That's the assignment and heres what I have so far, the problem is that in the void display function doesn't display anything, once I can figure this out then I can move on to the other steps.
#include<iostream>
#include<fstream>
#include<conio.h>
#include<iomanip>
#include<cmath>
// Associating program identifiers with external file names
#define in_file "data.txt"//input file name
#define out_file "result.txt"//output file name
using namespace std;
void errors(int [], int [], float []);
void display(int [], int [], float [], float []);
ifstream ins;// associates ins as an input stream
ofstream outs;// associates outs as an output stream
const int r=19;
int main()
{
//const int r=19;
int a[r];
int b[r];
float c[r];
float w[r];
ins.open(in_file);// associates ins as an input stream
outs.open(out_file);// associates outs as an output stream
//read_values(a, b, c);
//amount(a, b, c);
int i=0;
//float w[r];
char next_char;
cout<<"Errors: "<<endl;
while(!ins.eof())
{
ins>>a[i]>>b[i]>>c[i];
errors(a, b, c);
}
while(!ins.eof())
{
ins>>a[i]>>b[i]>>c[i];
w[i]=b[i]*c[i];
display(a, b, c, w);
}
_getch();
ins.close();// closing input file
outs.close();// closing output file
}
void display(int f[], int g[], float h[], float d[])
{
int i=0;
cout<<fixed<<showpoint;
cout<<setprecision(2);
cout<<setw(2)<<f[i]<<" "<<setw(2)<<g[i]<<" "<<setw(7)<<h[i]<<" "<<setw(7)<<d[i]<<endl;
cout<<endl;
i++;
}
void errors(int x[], int y[], float z[])
{
int i=0;
cout<<fixed<<showpoint;
cout<<setprecision(2);
if((x[i]<1)||(x[i]>20))
{
cout<<setw(2)<<x[i]<<" "<<setw(2)<<y[i]<<" "<<setw(7)<<z[i]<<" **invalid agent #**" <<endl;
}
else if(z[i]<0)
{
cout<<setw(2)<<x[i]<<" "<<setw(2)<<y[i]<<" "<<setw(7)<<z[i]<<" **invalid price**" <<endl;
}
i++;
}