Guest User

Untitled

a guest
Jul 18th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.80 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <stdbool.h>
  4.  
  5.  
  6. int main(int argc, char *argv[])
  7. {
  8.     bool kod = false;
  9.     int i, code;
  10.     char country;
  11.    
  12.     struct international
  13.     {
  14.            char *country;
  15.            int code;
  16.     };
  17.    
  18.     const struct international d_code[6] =
  19.     {     { "ARGENTINA", 54}, {"BRAZIL", 55}, {"CHINA", 86},
  20.           {"GERMANY", 49},    {"POLAND", 48}, {"USA", 1}    };
  21.          
  22.     printf("podaj kod: ");
  23.     scanf("%d", &code);
  24.    
  25.     for( i = 0; i < 6; i++)
  26.         if( code == d_code[i].code)
  27.         {
  28.             kod = true;
  29.             printf("kod %d to do %s\n", code, d_code[i].country);
  30.         }
  31.    
  32.     if(kod == false)
  33.          printf("nie ma takiego numeru\n");
  34.    
  35.    
  36.    
  37.    
  38.  
  39.   system("PAUSE"); 
  40.   return 0;
  41. }
Add Comment
Please, Sign In to add comment