I'm trying to write a code that will get values from a file and store them into a class variable. I'm not saving them according to my code. I would really appreciate the help. I don't know where my error is. The first value from the file is the number of class objects there is in total.
class customer {
    private:
        string *names;
        char *plans;
        int *hours;
        int customerTotal;
    public:
       string name;
       char plan;
       int hour;
       customer() {
              name = "";
              plan = ' ';
              hour = 0;
              customerTotal = 0;
        }
       void setName(string x) {
              names[customerTotal] = x;
        }
       void setPlan(char x) {
              plans[customerTotal] = x;
        }
       void setHours(int x){
              hours[customerTotal] = x;
              customerTotal++;
        }
       void printArray(){
             for (int i = 0; i < customerTotal;i++){
           cout << names[i] << plans[i] << hours[i] << endl;
         }
    }
};
int main() {
    int numCustomers;
    ifstream inFile;
    string n;
    char p;
    int h;
    inFile.open("customers.txt");
    if (!inFile)
    {
        cout << "File not found!" << endl << endl;
        system("pause");
        return 1;
    }
    customer x;
    inFile >> numCustomers;
    while (!(inFile.eof())) {
        inFile >> n >> p >> h;
            x.setName(n);
            x.setPlan(p);
            x.setHours(h);
    }
    x.printArray();
    inFile.close(); 
}
 
    