Bookoo errors!

G

GeekBoy

Seems I am having trouble understanding make a relation of accessing the
structs in functions;

Thanks in advance, since 10^10 messages an hour go through here.


#include<iostream>
#include<fstream>
#include<string>

using namespace std;

struct personnel
{
string fname; // members of personnel struct
string lname;
};
struct time
{
int hour; // members of time struct
int min;
};

// function prototypes

void getData(ifstream& iFile, string personnelEmployee[], const float
timeCardIn[], const float timeCardOut[], int index);
void hoursWorked(const float timeCardIn[], const float timeCardOut[], const
float hours[], int index);
int latest(const float timeCardOut[], int index);
void PrintData(ofstream& iFile, string personnelEmployee[], const float
timeCardIn[], const float timeCardOut[], int index, int mLate);

int main()
{
personnel employee[20]; // make personnel a member of struct personnel
time cardI[20]; // make cardI a memeber of struct time
time cardO[20];// make cardO a member of struct time
//time hoursW[20];

int Index, Late;
ifstream inFile;
ofstream outFile;

inFile.open("indata.txt"); //open the data file and check if file can be
opened
if (!inFile)
{
cerr << "Error Opening File" << endl;
system ("pause");
return -1;
}

outFile.open("outdata.txt"); //open or create this file

getData(inFile, employee, cardI, cardO, Index); //call the getData function

return 0;

} // end of main


// function to read data in from inData.txt file

void getData(ifstream& iFile, string personnelEmployee[], const float
timeCardIn[], const float timeCardOut[], int index)
{

int count = 0;

iFile >> personnelEmployee[count].fname >> personnelEmployee[count].lname >>
timeCardIn[count].hr timeCardIn[count].min;
while(! EOF)
{
count++;
iFile >> personnelEmployee[count].fname >> personnelEmployee[count].lname
>> timeCardIn[count].cardI;
}

}
// function to determine the amount of hours worked

hoursWorked(const float timeCardIn[], const float timeCardOut[], const float
hours, int count)
{ int x;
int minW;
for (x =0; x < count; x++)
minW = (timeCardOut[x].hr *60 + timeCardOut[x].min)- (timeCardIn[x].hr
* 60 + timeCardIn[x].min);

hours[x].hrs == minW/60;
hours[x].min == minW%60;

}



latest(const float timeCardOut,int index)
{
float minW;
int lateIndex = 0, int minW int x;
for (x = 0; x < index; x++)
minW=(timeCardOut[x].hr *60 + timeCardOut[x].min);
if (minW > timeCardOut[lateIndex].hr * 60 + timeCardOut[lateIndex].min)
lateIndex = x;
return;
}


// function to print the final data calculated
printData(ofstream& oFile, string personnelEmployee[], const float
timeCardIn[], const float timeCardOut[], int index, int mLate);"

{

for (int x=o; x < index; x++)
{
file << personnelEmployee[x].fname << personnelEmployee[x].lname <<
timeCardOut[x];
}




}
 
J

John Harrison

GeekBoy said:
Seems I am having trouble understanding make a relation of accessing the
structs in functions;

Make the changes below, you might be a little closer.

john
Thanks in advance, since 10^10 messages an hour go through here.


#include<iostream>
#include<fstream>
#include<string>

using namespace std;

struct personnel
{
string fname; // members of personnel struct
string lname;
};
struct time
{
int hour; // members of time struct
int min;
};

// function prototypes

void getData(ifstream& iFile, string personnelEmployee[], const float
timeCardIn[], const float timeCardOut[], int index);

void getData(ifstream& iFile, personnel personnelEmployee[], time
timeCardIn[], time timeCardOut[], int& count);
void hoursWorked(const float timeCardIn[], const float timeCardOut[], const
float hours[], int index);
int latest(const float timeCardOut[], int index);
void PrintData(ofstream& iFile, string personnelEmployee[], const float
timeCardIn[], const float timeCardOut[], int index, int mLate);

int main()
{
personnel employee[20]; // make personnel a member of struct personnel
time cardI[20]; // make cardI a memeber of struct time
time cardO[20];// make cardO a member of struct time

You mean array not member
//time hoursW[20];

int Index, Late;
ifstream inFile;
ofstream outFile;

inFile.open("indata.txt"); //open the data file and check if file can be
opened
if (!inFile)
{
cerr << "Error Opening File" << endl;
system ("pause");
return -1;
}

outFile.open("outdata.txt"); //open or create this file

getData(inFile, employee, cardI, cardO, Index); //call the getData function

return 0;

} // end of main


// function to read data in from inData.txt file

void getData(ifstream& iFile, string personnelEmployee[], const float
timeCardIn[], const float timeCardOut[], int index)

void getData(ifstream& iFile, personnel personnelEmployee[], time
timeCardIn[],
time timeCardOut[], int& count);
{

int count = 0;
>
> iFile >> personnelEmployee[count].fname >>
personnelEmployee[count].lname >>
> timeCardIn[count].hr timeCardIn[count].min;
> while(! EOF)
> {
> count++;
> iFile >> personnelEmployee[count].fname >> personnelEmployee[count].lname
> >> timeCardIn[count].cardI;
> }


count = 0;
while (iFile >> personnelEmployee[count].fname >>
personnelEmployee[count].lname >>
timeCardIn[count].hr timeCardIn[count].min)
{
++count;
}
}
// function to determine the amount of hours worked

hoursWorked(const float timeCardIn[], const float timeCardOut[], const float
hours, int count)
{ int x;
int minW;
for (x =0; x < count; x++)
minW = (timeCardOut[x].hr *60 + timeCardOut[x].min)- (timeCardIn[x].hr
* 60 + timeCardIn[x].min);

hours[x].hrs == minW/60;
hours[x].min == minW%60;

}



latest(const float timeCardOut,int index)
{
float minW;
int lateIndex = 0, int minW int x;
for (x = 0; x < index; x++)
minW=(timeCardOut[x].hr *60 + timeCardOut[x].min);
if (minW > timeCardOut[lateIndex].hr * 60 + timeCardOut[lateIndex].min)
lateIndex = x;
return;
}


// function to print the final data calculated
printData(ofstream& oFile, string personnelEmployee[], const float
timeCardIn[], const float timeCardOut[], int index, int mLate);"

{

for (int x=o; x < index; x++)
{
file << personnelEmployee[x].fname << personnelEmployee[x].lname <<
timeCardOut[x];
}




}
 
G

GeekBoy

Thanks a lot!

woo hoo

John Harrison said:
GeekBoy said:
Seems I am having trouble understanding make a relation of accessing the
structs in functions;

Make the changes below, you might be a little closer.

john
Thanks in advance, since 10^10 messages an hour go through here.


#include<iostream>
#include<fstream>
#include<string>

using namespace std;

struct personnel
{
string fname; // members of personnel struct
string lname;
};
struct time
{
int hour; // members of time struct
int min;
};

// function prototypes

void getData(ifstream& iFile, string personnelEmployee[], const float
timeCardIn[], const float timeCardOut[], int index);

void getData(ifstream& iFile, personnel personnelEmployee[], time
timeCardIn[], time timeCardOut[], int& count);
void hoursWorked(const float timeCardIn[], const float timeCardOut[],
const float hours[], int index);
int latest(const float timeCardOut[], int index);
void PrintData(ofstream& iFile, string personnelEmployee[], const float
timeCardIn[], const float timeCardOut[], int index, int mLate);

int main()
{
personnel employee[20]; // make personnel a member of struct personnel
time cardI[20]; // make cardI a memeber of struct time
time cardO[20];// make cardO a member of struct time

You mean array not member
//time hoursW[20];

int Index, Late;
ifstream inFile;
ofstream outFile;

inFile.open("indata.txt"); //open the data file and check if file can be
opened
if (!inFile)
{
cerr << "Error Opening File" << endl;
system ("pause");
return -1;
}

outFile.open("outdata.txt"); //open or create this file

getData(inFile, employee, cardI, cardO, Index); //call the getData
function

return 0;

} // end of main


// function to read data in from inData.txt file

void getData(ifstream& iFile, string personnelEmployee[], const float
timeCardIn[], const float timeCardOut[], int index)

void getData(ifstream& iFile, personnel personnelEmployee[], time
timeCardIn[],
time timeCardOut[], int& count);
{

int count = 0;

iFile >> personnelEmployee[count].fname >>
personnelEmployee[count].lname >>
timeCardIn[count].hr timeCardIn[count].min;
while(! EOF)
{
count++;
iFile >> personnelEmployee[count].fname >> personnelEmployee[count].lname
timeCardIn[count].cardI;
}


count = 0;
while (iFile >> personnelEmployee[count].fname >>
personnelEmployee[count].lname >>
timeCardIn[count].hr timeCardIn[count].min)
{
++count;
}
}
// function to determine the amount of hours worked

hoursWorked(const float timeCardIn[], const float timeCardOut[], const
float hours, int count)
{ int x;
int minW;
for (x =0; x < count; x++)
minW = (timeCardOut[x].hr *60 + timeCardOut[x].min)-
(timeCardIn[x].hr * 60 + timeCardIn[x].min);

hours[x].hrs == minW/60;
hours[x].min == minW%60;

}



latest(const float timeCardOut,int index)
{
float minW;
int lateIndex = 0, int minW int x;
for (x = 0; x < index; x++)
minW=(timeCardOut[x].hr *60 + timeCardOut[x].min);
if (minW > timeCardOut[lateIndex].hr * 60 +
timeCardOut[lateIndex].min)
lateIndex = x;
return;
}


// function to print the final data calculated
printData(ofstream& oFile, string personnelEmployee[], const float
timeCardIn[], const float timeCardOut[], int index, int mLate);"

{

for (int x=o; x < index; x++)
{
file << personnelEmployee[x].fname << personnelEmployee[x].lname <<
timeCardOut[x];
}




}
 
G

GeekBoy

Work on it in the morning


John Harrison said:
GeekBoy said:
Seems I am having trouble understanding make a relation of accessing the
structs in functions;

Make the changes below, you might be a little closer.

john
Thanks in advance, since 10^10 messages an hour go through here.


#include<iostream>
#include<fstream>
#include<string>

using namespace std;

struct personnel
{
string fname; // members of personnel struct
string lname;
};
struct time
{
int hour; // members of time struct
int min;
};

// function prototypes

void getData(ifstream& iFile, string personnelEmployee[], const float
timeCardIn[], const float timeCardOut[], int index);

void getData(ifstream& iFile, personnel personnelEmployee[], time
timeCardIn[], time timeCardOut[], int& count);
void hoursWorked(const float timeCardIn[], const float timeCardOut[],
const float hours[], int index);
int latest(const float timeCardOut[], int index);
void PrintData(ofstream& iFile, string personnelEmployee[], const float
timeCardIn[], const float timeCardOut[], int index, int mLate);

int main()
{
personnel employee[20]; // make personnel a member of struct personnel
time cardI[20]; // make cardI a memeber of struct time
time cardO[20];// make cardO a member of struct time

You mean array not member
//time hoursW[20];

int Index, Late;
ifstream inFile;
ofstream outFile;

inFile.open("indata.txt"); //open the data file and check if file can be
opened
if (!inFile)
{
cerr << "Error Opening File" << endl;
system ("pause");
return -1;
}

outFile.open("outdata.txt"); //open or create this file

getData(inFile, employee, cardI, cardO, Index); //call the getData
function

return 0;

} // end of main


// function to read data in from inData.txt file

void getData(ifstream& iFile, string personnelEmployee[], const float
timeCardIn[], const float timeCardOut[], int index)

void getData(ifstream& iFile, personnel personnelEmployee[], time
timeCardIn[],
time timeCardOut[], int& count);
{

int count = 0;

iFile >> personnelEmployee[count].fname >>
personnelEmployee[count].lname >>
timeCardIn[count].hr timeCardIn[count].min;
while(! EOF)
{
count++;
iFile >> personnelEmployee[count].fname >> personnelEmployee[count].lname
timeCardIn[count].cardI;
}


count = 0;
while (iFile >> personnelEmployee[count].fname >>
personnelEmployee[count].lname >>
timeCardIn[count].hr timeCardIn[count].min)
{
++count;
}
}
// function to determine the amount of hours worked

hoursWorked(const float timeCardIn[], const float timeCardOut[], const
float hours, int count)
{ int x;
int minW;
for (x =0; x < count; x++)
minW = (timeCardOut[x].hr *60 + timeCardOut[x].min)-
(timeCardIn[x].hr * 60 + timeCardIn[x].min);

hours[x].hrs == minW/60;
hours[x].min == minW%60;

}



latest(const float timeCardOut,int index)
{
float minW;
int lateIndex = 0, int minW int x;
for (x = 0; x < index; x++)
minW=(timeCardOut[x].hr *60 + timeCardOut[x].min);
if (minW > timeCardOut[lateIndex].hr * 60 +
timeCardOut[lateIndex].min)
lateIndex = x;
return;
}


// function to print the final data calculated
printData(ofstream& oFile, string personnelEmployee[], const float
timeCardIn[], const float timeCardOut[], int index, int mLate);"

{

for (int x=o; x < index; x++)
{
file << personnelEmployee[x].fname << personnelEmployee[x].lname <<
timeCardOut[x];
}




}
 
V

Victor Bazarov

John said:
GeekBoy said:
Seems I am having trouble understanding make a relation of accessing
the structs in functions;

Make the changes below, you might be a little closer.

john
[..]

// function to read data in from inData.txt file

void getData(ifstream& iFile, string personnelEmployee[], const float
timeCardIn[], const float timeCardOut[], int index)

void getData(ifstream& iFile, personnel personnelEmployee[], time
timeCardIn[],
time timeCardOut[], int& count);

Really? A semicolon? :))) Gotcha!
{

int count = 0;

iFile >> personnelEmployee[count].fname >>
personnelEmployee[count].lname >>
timeCardIn[count].hr timeCardIn[count].min;
while(! EOF)
{
count++;
iFile >> personnelEmployee[count].fname >>
personnelEmployee[count].lname >> timeCardIn[count].cardI;
}
[..]

V
 
J

John Harrison

Victor said:
John said:
GeekBoy said:
Seems I am having trouble understanding make a relation of accessing
the structs in functions;
Make the changes below, you might be a little closer.

john
[..]

// function to read data in from inData.txt file

void getData(ifstream& iFile, string personnelEmployee[], const float
timeCardIn[], const float timeCardOut[], int index)
void getData(ifstream& iFile, personnel personnelEmployee[], time
timeCardIn[],
time timeCardOut[], int& count);

Really? A semicolon? :))) Gotcha!

Yes indeed, cut and paste strikes again.

john
 
G

GeekBoy

Victor Bazarov said:
John said:
GeekBoy said:
Seems I am having trouble understanding make a relation of accessing
the structs in functions;

Make the changes below, you might be a little closer.

john
[..]

// function to read data in from inData.txt file

void getData(ifstream& iFile, string personnelEmployee[], const float
timeCardIn[], const float timeCardOut[], int index)

void getData(ifstream& iFile, personnel personnelEmployee[], time
timeCardIn[],
time timeCardOut[], int& count);

Really? A semicolon? :))) Gotcha!

Extreme programming strikes again.
{

int count = 0;

iFile >> personnelEmployee[count].fname >>
personnelEmployee[count].lname >>
timeCardIn[count].hr timeCardIn[count].min;
while(! EOF)
{
count++;
iFile >> personnelEmployee[count].fname >>
personnelEmployee[count].lname >> timeCardIn[count].cardI;
}
[..]

V
 
B

BobR

GeekBoy said:
If you did not use dial-up then it would only take .0000001 seconds to
load.

PLONK!!

Took .0000001 seconds!
.... and good luck with trying to get help here.
 
G

GeekBoy

BobR said:
load.

PLONK!!

Took .0000001 seconds!
... and good luck with trying to get help here.

"PLONK" deeez nutz.

Only "help" you gave was being a net nanny
 
J

Jorgen Grahn

net nanny net nanny

What an extraordinarily stupid response from someone who just received
a whole lot of free help from dedicated group members. *plonk*
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top