struct student{ int num; char name[20]; ...; }
结构体的定义
student stud[4];
数组变量的定义
void input (student &stud){ cout<<"请输入xxx:"; cin>>stud . num; cout<<"....."; cin>>....; } void output ( student &stud){ cout<<"....."; } for ( int i = 0 ; i<=3 ; i++){ input (stud[i]; } for(int i = 0 ; i<=3 ; i++){ output(stud[i]); }
结构体数组的使用