Hello,

I have a question. i have to write a program that cvalculates the average number of days a company's employees are absent. The program should have the following functions:

A functcion called by main that asks teh user for the number of employees in the company. this value should be returned as an int. (no parameters)

A function called by main that accepts one argument: the number of employees in the company. the function should ask the user to enter the number of employees in the company. The function should ask teh user to enter the number of days each employee missed during the past year. The total of these days should be returned as an int.

A function called by main that takes two parameters: the number of employees in the company and the total number of days absent for all employees during the year. The function should return as a double, the average number of days absent. (this function does not perform any screen output and does not ask the user for input.

Can anyone help i am getting many errors

Recommended Answers

All 3 Replies

First, wonder what information would be helpful to people who want to help you.

should i post the program i have written? would ube able to help and see what is goin on ??

#include <iostream>
#include <stdlib.h>
#include <math.h>
using namespace std;

	int    getnum_employees=0;
	int    getdays_missed=0;
	int    total_days_missed=0;
	double days_missed_average;

int main ()
{

        cout<<"Please enter the number of employees"<<endl;
        cin>>getnum_employees;
    
        return getnum_employees;
}

int getdays_missed(int num_employees)
{
                          while (num_employees>=1)
                       {
    	               cout<<"Please enter days missed"<<endl;
    	               cin>>getdays_missed;
    	
                       total_days_missed += getdays_missed;
    	               num_employees--;
    	               else;
}

     return getdays_missed;
}

     double days_missed_average(int num_employees, int days_missed)
{
                days_missed_average = days_missed/num_employees;
	            cout<<"Average days missed: "<<days_missed_average;
	            system("pause");
return 0;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.