I wrote up this code for an assignment, but...I'm stuck:
Any ideas?Code:#include <iostream>
#include <iomanip>
#include "people.h"
using namespace std;
int main(int argc, char *argv[]) {
PEOPLE *paPeople = NULL;
int iNumToEnter = 0;
cout << "Number of people to enter: ";
cin >> iNumToEnter;
if (paPeople != NULL) {
exit(0);
}
paPeople = new PEOPLE[iNumToEnter];
for (int i = 0; i < iNumToEnter; i++) {
cout << "Person #" << (i + 1) << "'s Name: ";
cin.ignore();
cin >> paPeople->szName;
cout << "Age of " << paPeople->szName << ": ";
cin >> paPeople->age;
}
system("CLS");
//SHWINK, problem here:
for (int i = 0; i < iNumToEnter; i++) {
cout << paPeople->szName << endl;
}
return 0;
}
