I'm doing this void homework for class and I can't figure out how to fix my last single error.This is the code
#include <iostream> //for using cin and cout
#include <conio.h> //for using getch()
using namespace std;
void GetEmployees(int& NumEmployees)
{
cout << "How many employees are in the company? ";
cin >> NumEmployees;
while (NumEmployees < 1)
{
cout << "Invalid number\n";
cout << "Please enter a valid number: ";
cin >> NumEmployees;
}
}
void CalculateAbsences(int daysMissed, int& total)
{
total = 0;
cout << "Enter the absences for each employee? (enter negative to end)";
while (daysMissed > -1) //so absences is always above -1
{
cin >> daysMissed;
if (daysMissed > -1)
{
total = total + daysMissed; //keep adding until negative is entered
}
}
}
double CalculateAverage(int NumEmployees, int total)
{
double average = static_cast<double>(total)/NumEmployees;
return average;
}
void DisplayResults(double average, int NumEmployees)
{
cout << "The average is: " << average << endl;
cout << "The number of employees are " << NumEmployees << endl;
}
int main()
{
int employeeCount;
int daysAbsent;
int totalAbsences;
GetEmployees(employeeCount);
CalculateAbsences(employeeCount, totalAbsences);
CalculateAverage(employeeCount, totalAbsences);
DisplayResults(CalculateAverage, employeeCount);
getch();
return 0;
}
The error is 'DisplayResults' : cannot convert parameter 1 from 'double (__cdecl *)(int,int)' to 'double'
It's on void DisplayResults. I tried to remove the parameter variable but it became worse.