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?