#include <iostream>
#include <fstream>
int main()
{
if( std::ifstream file{ "empdepart.txt" } ) // if the file is opened for input
{
constint ARRAY_SZ = 4 ;
int counts[ARRAY_SZ] {} ; // initialise to all zeroes
int id ;
while( file >> id ) // for each id read from the file
{
// classify and increment appropriate count
// note: array positions start at zero
if (id >= 100 && id <= 299) ++counts[0] ; // Security
elseif (id <= 499) ++counts[1] ; // Accounting // note: else if
elseif (id <= 799 ) ++counts[2] ; // Engineering
elseif (id <= 899 ) ++counts[3] ; // Legal
else ; // *** error *** this is an invalid id
}
// TO DO: add code to print out the four counts
}
else std::cerr << "failed to open input file\n" ;
}