1041試験座席番号(C言語)

4745 ワード

設計構想:
  • 配列記憶を利用する、
  • を検索する.
    コンパイラ:C(gcc)
    #include 
    #include 
    
    typedef struct study{
        char num[17];
        int b;
    }study; 
    
    int main()
    {
        study studys[1001];
        int n, a, b;
        char num[17];
        scanf("%d", &n);
        while(n--){ 
            scanf("%s %d %d", num, &a, &b);
            strcpy(studys[a].num, num);
            studys[a].b = b;
        }
        scanf("%d", &n);
        while(n--){ 
            scanf("%d", &a);
            printf("%s %d
    "
    , studys[a].num, studys[a].b); } return 0; }