我是初学者,请问这个结构体哪里出问题了
#include<iostream>using namespace std;
#include<string>
struct hero
{
string name;
string sex;
int age;
};
void putt()
{
for(int i=0;i<5;i++)
{
cout<<"姓名:"<<unit[i].name
<<"年龄:"<<unit[i].age
<<"性别:"<<unit[i].sex<<endl;
}
}
void main()
{
struct hero unit[5]=
{
{"刘备","男",45},
{"关于","男",28},
{"张飞","男",45},
{"赵云","男",49},
{"貂蝉","女",18},
};
putt();
}