I am working on this program below. The problem I am having is trying to return totalDays to the main. In the numOfDays() function there is a for loop that adds the totalDays (totalDays = totalDays + days). I have just been getting errors in returning the correct amount of totalDays to the main from the numOfDays function.
#include <iostream>
usingnamespace std;
int numOfEmployees();
int numOfDays(int);
int main()
{
int totalDays = 0;
int employNum;
int amountSick;
employNum = numOfEmployees();
amountSick = numOfDays(employNum);
cout << amountSick;
}
int numOfEmployees()
{
int employees;
cout << "How many employees? ";
cin >> employees;
return employees;
}
int numOfDays(int employees)
{
int num = 1;
int totalDays = 0;
for (employees; employees > 0; employees --)
{
int days;
int totalDays = 0;
cout << "How many days has employee " <<num<< " been sick? ";
cin >> days;
totalDays = totalDays + days;
num ++;
}
return totalDays;
}