Help I'm really confused here?

So basically part of a program asks me to do this:

"A function called by main that accepts two arguments: The name of the file stream object as a reference parameter to the file stream, and the number of employees in the company. The function should as integers for the employee: The employee ID # and and the number of days the employees missed during the past year. Each employee number should be written to the file report in the function. "


My guess is that the function looks like this: int Name ( string fileName, int employeesNumber)

The thing is that I already did a function for the number of employees (without parameters) now it's asking me to do it again? Also I don't know how to write to a file report while using it as part of an argument.



So far I have:



#include <iostream>
#include <string>
#include <fstream>
#include <iomanip>
using namespace std;

int getEmployeeNumber();




int main() {


cout << fixed << showpoint << setprecision(1);

int employees;
employees = getEmployeeNumber();







return 0;
}

int getEmployeeNumber()

{
int employeeNumber;
cout << "Please enter the number of employees in the company: "<<endl;
cin >> employeeNumber;
return employeeNumber;
}


it wants the stream itself, not the file name. The text is garbled but I assume it wants you to return multiple items ....

something like

struct mytype
{
int idnum;
int days missed;
... other stuff?
};


mytype foo(ifstream &ifs, int numemployees);

is how I read the problem.

Does this help?



Yeah, it does want a couple returns and I'm using an outstream too. It also asks for the total of missed days to be returned as an int, so wouldn't it be more like:



int mytype foo(ifstream &ifs, int numemployees);(btw is this the part that goes in the defining part at the end)


(and this part calls to the main?)

struct mytype
{
int idnum;
int days missed;
... other stuff?
};


What does struct, foo, &ifs mean?


since it said to return the function as integers,
Last edited on
Topic archived. No new replies allowed.