#include <iostream>
#include <string>
usingnamespace std;
struct Profile
{
string name;
string hospitalOfBirth;
string city;
int dayOfBirth;
int monthOfBirth;
int yearOfBirth;
};
int profileNum;
Profile* personProfile = new Profile[profileNum];
int main()
{
cout << "Enter the number of profiles: ";
cin >> profileNum;
for(int i = profileNum; i <= profileNum; i++)
{
cout << "Enter the name of this person: ";
getline(cin, personProfile[i].name);
cin.ignore();
}
delete [] personProfile;
cin.ignore();
return 0;
}
i = 3; i <= 3; i++. This is a problem. Try i = 0; and i < profileNum.
Profile* personProfile = new Profile[profileNum];
This line is a problem. You need to give this array a size. new Profile[5] for example would be a valid size and you would not get that runtime error. At the moment, the size is whatever junk value is in int profileNum.