#include
#include
#include
using namespace std;
typedef struct person
{
string name;
vector length;
}person,*person_List;
int main()
{
int number;
person_List p;
person p1;
p = (person_List)malloc(sizeof(person));
for(int i = 0;i < 5;i ++)
{
cin >> number;
p->length.push_back(number);
}
for(i = 0;i < p->length.size();i++)
cout << p->length[i] << " " ;
return 0;
}
用结构体p1是对的,但是用结构体指针就不对了,不知道为什么?求大神指导啊!