#include
#include
#include
#include
//for logfile
struct log
{
long number;
char date[9];
char time[9];
char gate[2];
};
//for customers
struct customer
{
long number;
char initial[2];
char lname[20];
char snumber[7];
char sname[17];
char stype[17];
char suburb[17];
char state[4];
char postcode[5];
};
//constants for array sizes
const int MAXLOGS=50;
const int MAXCUST=20;
// function protoytpes
int searchProcessed(long[],long,int);//searches already processed records
int find (customer[],long,int); //searches customer array
void showHeadings(); //show headings
void drawline(); //draws line
int main ()
{
//declare array to hold logs
log logArray[MAXLOGS];
//declare infile stream and link to log.txt
ifstream in;
in.open("log.txt");
int numOfLogs = 0; // number of logs
//load-up array with logs
while(!in.eof())
{
in >> logArray[numOfLogs].number;
in >> logArray[numOfLogs].date;
in >> logArray[numOfLogs].time;
in >>logArray[numOfLogs].gate;
in >> ws;
numOfLogs++;
}
in.close();
//declare array of type customer
customer customerArray[MAXCUST];
//open the file
in.open("customer.txt");
int numberOfCustomers = 0; //number of customers
//load-up array with customers
while(!in.eof())
{
in >> customerArray[numberOfCustomers].number;
in >> customerArray[numberOfCustomers].initial;
in >> customerArray[numberOfCustomers].lname;
in >> customerArray[numberOfCustomers].snumber;
in >> customerArray[numberOfCustomers].sname;
in >> customerArray[numberOfCustomers].stype;
in >> customerArray[numberOfCustomers].suburb;
in >> customerArray[numberOfCustomers].state;
in >> customerArray[numberOfCustomers].postcode;
in >> ws;
numberOfCustomers++;
}
in.close();
//declare array of type long, to hold custNumbers of
//previously processed records
long processed[MAXLOGS];
//initialize to zero
for (int i=0;i=0)
{
drawline(); //draw a line
cout << "\nEWAY BILL E-way Motorway\n"
<< " " << customerArray[position].number;
cout << "\n \n"<