Advertisement
Infernale

Student Data

Dec 14th, 2018
464
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.60 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main(){
  4.     int n, q, in;
  5.     scanf("%d", &n);
  6.     struct{
  7.         int id, d, m, y;
  8.         char name[11], address[11];
  9.     }data[n];
  10.     for(int i=0;i<n;i++){
  11.         scanf("%d %d %d %d %s %s", &data[i].id, &data[i].d, &data[i].m, &data[i].y, &data[i].name, &data[i].address);
  12.     }
  13.     scanf("%d", &q);
  14.     while(q--){
  15.         scanf("%d", &in);
  16.         for(int i=0;i<n;i++){
  17.             if(data[i].id==in){
  18.                 printf("%d. %s was born on %d/%d/%d and live at %s\n", data[i].id, data[i].name, data[i].d, data[i].m, data[i].y, data[i].address);
  19.                 break;
  20.             }
  21.             if(i==n-1){
  22.                 printf("No data found!\n");
  23.             }
  24.         }
  25.     }
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement