Can anyone tell me how to fill this array from an infile?? I'm so confused. We just started on classes I'm just not sure how to fill this array from an infile I know my code is wrong but I'm not understanding how to do what I need to do with things being private.
#include <iostream>
#include <fstream>
using namespace std;
const int ARRAY_SIZE=10;
class clockType
{
public:
void setTime(int,int,int);
void getTime(int& ,int& ,int& )const;
void print()const;
clockType(int=0,int=0,int=0);
private:
int hr;
int min;
int sec;
};
void print(clockType[]);
void fill(clockType[]);
int main ()
{
clockType timeIn[5];
print(timeIn);
fill(timeIn);
print(timeIn);
}
void print(clockType in[])
{
for(int i=0;i<5;i++)
{
cout<<"Employee"<<i+1<<" clock in time = ";
in[i].print();
cout<<endl;
}
}
void fill (clockType in[])
{
ifstream inFile;
inFile.open("mymenus.txt");
int h,m,s;
for(int i =0;i<5;i++)
{
cout<<"Enter clock in time"<< i+1<<" ";
int counter=0;
for (int i=0; i<ARRAY_SIZE;i++)
{
getline(inFile,in[i].h);
getline(inFile,in[i].m);
getline(inFile,in[i].s);
in[i].setTime(h,m,s);