Вы должны выделить объект, на который будет указывать st
перед разыменованием st
.
Также вы должны удалить то, что выделено.
int main()
{
SLL * st;
int n=3;
Address ad,rad;
st = new SLL; // add this
while(n--)
{
cout << "enter the name : ";
cin >> ad.name;
cout << "enter the adderess : ";
cin >> ad.address;
st->madder.push_back(ad);
}
while (!st->madder.empty())
{
rad = st->madder.back();
cout << rad.name << " " <<rad.address <<endl;
st->madder.pop_back();
}
delete st; // add this
}
Другой вариант не использует указатель и выделение объекта SLL
непосредственно как переменной.
int main()
{
SLL st;
int n=3;
Address ad,rad;
while(n--)
{
cout << "enter the name : ";
cin >> ad.name;
cout << "enter the adderess : ";
cin >> ad.address;
st.madder.push_back(ad);
}
while (!st.madder.empty())
{
rad = st.madder.back();
cout << rad.name << " " <<rad.address <<endl;
st.madder.pop_back();
}
}