请各位大神帮我寻找一下这个C程序的错误!
#include<iostream>#include<string>
using namespace std;
struct person
{
string name;
int num;
char sex;
char job;
union P
{
float grade;
string prof;
}kind;
};
int main()
{
int i;
person stu[3];
cout<<"请输入职员信息:"<<endl;
for(i=0;i<3;i++)
{
cin>>stu[i].name>>stu[i].num>>stu[i].sex>>stu[i].job;
if(stu[i].job=='t')
cin>>stu[i].kind.prof;
else
cin>>stu[i].kind.grade;
}
cout<<"列表内学生信息为:"<<endl;
for(i=0;i<3;i++)
{
if(stu[i].job=='t')
cout<<stu[i].name<<'_'<<stu[i].num<<'_'<<stu[i].sex<<'_'<<stu[i].job<<'_'<<stu[i].kind.prof<<endl;
else
cout<<stu[i].name<<'_'<<stu[i].num<<'_'<<stu[i].sex<<'_'<<stu[i].job<<'_'<<stu[i].kind.grade<<endl;
}
}