1041 考试座位号 (15分)

#include <string.h>
#include <iostream>
using namespace std;

struct STU
{
    char stu_no[18];
    int test_seat;
    int seat;
};

int main()
{
    int n,m;
    struct STU stu[1005];
    int m_seat[1005];
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>stu[i].stu_no>>stu[i].test_seat>>stu[i].seat;
    cin>>m;
    for(int i=0;i<m;i++)
        cin>>m_seat[i];
    for(int i=0;i<m;i++)
    {
        for(int j=0;j<n;j++)
        {
            if(m_seat[i]==stu[j].test_seat)
            {
                cout<<stu[j].stu_no<<" "<<stu[j].seat<<endl;
            }
        }
    }
    return 0;
}
原文地址:https://www.cnblogs.com/QRain/p/12252504.html