Can somebody please tell me what is wrong in here or what does this error message means : " error
: reguest for member 'name' in 'person',which is of non-class type 'Person[2]' "
struct Person{
int days;
string name;
};
const int size = 2;
bool way_to_Sort(const Person &a, const Person &b) {return a.days < b.days;}
int main()
{
Person person[size];
for(int i = 0;i<=size;i++){
cout << "Please enter a friend : ";
cin >> person.name[i];cout << endl; // error here
cout << "Please enter num of days : ";
cin >> person.days[i];cout << endl; // here
}
sort(begin(person),end(person),way_to_Sort);
for(int i = 0;i<size;i++){
cout << "Names by days : " << person.name[i]<<endl; //here
}
}