#include<iostream> using namespace std; struct st{ string st_name; int st_age; }; struct c1{ string cl_name; st st1[7]; st st2[7]; }; struct a1{ c1 st1[100]; }; int main(){ c1 a[100]; cin>>a[0].cl_name; int j; for(j=0;j<3;j++){ for(int i=0;i<7;i++){ cin>>a[j].st1[i].st_name; cin>>a[j].st2[i].st_age; } } string d; cin>>d; if(d==a[j].cl_name){ for(int i=0;i<7;i++){ cout<<a[j].st1[i].st_name<<" "<<a[j].st2[i].st_age<<endl; } }else if(d==a[j].cl_name){ for(int i=0;i<7;i++){ cout<<a[j].st1[i].st_name<<" "<<a[j].st2[i].st_age<<endl; } }else if(d==a[j].cl_name){ for(int i=0;i<7;i++){ cout<<a[j].st1[i].st_name<<" "<<a[j].st2[i].st_age<<endl; } } return 0; }标签:班级,name,cl,int,struct,st,st1,一维,结构 From: https://www.cnblogs.com/w6826301/p/18578049