so i have to make three functions.One asks for how many employees are in a company.The other asks how many days they missed.The third one calculates the average by dividing the amount of employees by the number of days missing.In main,all i have to do is have cout prompts and call the functions.Im not to sure if i'm doing it right,but it crashes when it has to calculate the average.
#include <iostream>
#include <iomanip>
using namespace std;
int employee(int employeeNum);
int missingDays(int daysMissing);
double getAvg(int employeeNum,int daysMissing,double average);
int employee(int employeeNum)
{
cout<<"Enter the number of employee in the company.";
cin>>employeeNum;
return employeeNum;
}
int missingDays(int daysMissing)
{
cout<<"Enter the amount of days employees missed during the past year.";
cin>>daysMissing;
return daysMissing;
}
double getAvg(int employeeNum,int daysMissing,double average)
{
average=employeeNum/daysMissing;
return average;
}
int main()
{
int employeeNum,people,missing,daysMissing;
double avg,average;
people=employee(employeeNum);
cout<<"The number of employees in the company is "<<people<<"."<<endl;
missing=missingDays(daysMissing);
cout<<"The number of days employees missed during the past year is "<<missing<<".";
avg=getAvg(employeeNum,daysMissing,average);
cout<<average;
}
Let me know what i got to do and thanks for the help.