结构体数组定义与使用

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]);
}

结构体数组的使用

原文地址:https://www.cnblogs.com/likeghee/p/9983830.html