class of array call

I have this code and I want to reuse the information from my array but I don't know how to call it
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
//******************************************************************
// Assignment 5
// Programmer: Christy Sylvest
// Completed : 04/16/08
// Status    : Complete
//
//******************************************************************

#include <iostream>      // input/output declarations
#include <iomanip>       // i/o manupulator declarations
#include <fstream>       //output file declarations
#include <string>

using namespace std;
using std::ofstream;
using std::ios;
using std::string;


class masterInfo  
{
      
      private:
              int id;
              string name;
              double payrate;
              int numDep;
              int empType;

      public:
             void getid ();
             void getname ();
             void getpayrate();
             void getnumDep();
             void getempType();
             
             
             
};

    void masterInfo::getid()     
    {
    cin >> id;
    }
    void masterInfo::getname() 
    {
    cin >> name;
    getline(cin,name);
    
    }
    void masterInfo::getpayrate() 
    {
    cin >> payrate;
    }
    void masterInfo::getnumDep()
    {
    cin >> numDep;
    }
    void masterInfo::getempType()
    {
    cin >> empType;
    }


int main ()
{
    
    int empNum = 1;
    masterInfo x;
    masterInfo timeSheet [5];
    double hrsWkd;
    string empname;


    //open outputfile
    ofstream fout("payroll_report.txt");
	 
    
    if (!fout)
    {
    cout << "file not open";
    }
    
    for(int empNum = 1; empNum < 5; empNum++)
    
    {
          cout << "Enter information for employee " << empNum << endl;
          cout <<"Employee id: ";
          timeSheet[empNum].getid();
          cout <<endl;
          cout <<"Employee name: ";
          timeSheet[empNum].getname();
          cout <<endl;
          cout <<"Pay rate: ";
          timeSheet[empNum].getpayrate();
          cout <<endl;
          cout <<"Dependents: ";
          timeSheet[empNum].getnumDep();
          cout <<endl;
          cout <<"Type: ";
          timeSheet[empNum].getempType();
          cout <<endl;           
          
    
    }               
    
    cout <<"Enter timecard information for each employee:"<<endl;
     for(int empNum = 1; empNum < 5; empNum++)
     
     {
             cout <<"Hours worked for"<<empname<<":"<<endl;
     
             cin >> hrsWkd;
     }
    
system ("PAUSE");
return 0;
}   
    
    
    
    
    

now what i need to do is enter the employee name from getname to empname in my cout. How do I do that? access the information in my class of array?
Topic archived. No new replies allowed.