0

I've gotten stuck on my assignment. The compiler says that the code is fine, but the program doesn't work properly.

#include <iostream>
#include <iomanip>
#include <fstream>
using namespace std;
void display_days (int []);
void total_days (int []);
void average_days (int []);
void maximum_days (int []);
void minimum_days (int []);
int main()
{
	const int size = 50;
	char filename[size];
	int total_employees;
	int employees[size] ;
	ifstream inFile;

	cout << "\tCALCULATE AVERAGE EMPLOYEE ABSENCE\n";
	cout << "Please enter the name of the input file: ";
	cin >> filename;
	inFile.open(filename);
	inFile >> total_employees;
	if (total_employees >= 0)
	{
		for (int count = 0; count < total_employees; count++)
				inFile >> employees[count];
		for (int count = 0; count < total_employees; count++)
				cout << employees[count];
	}
			
return 0;
}

the input file contains:
10
3
0
1
2
4
-7
1
3
2
1
What's gone wrong with my code?

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by jonsca
0

Nothing that I can see. What is the result you are expecting? (note that you don't have a newline after your cout, so your numbers are all crammed together.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.