Advertisement
Guest User

Untitled

a guest
Nov 25th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.75 KB | None | 0 0
  1. #include <stdio.h>
  2. #define seat 10
  3.  
  4. int main()
  5. {
  6.     int customer[seat] = { 0 };
  7.     char a = 0;
  8.     int b, i;
  9.  
  10.     printf("좌석을 예약하시겠습니까?(y 또는 n) ");
  11.     scanf("%c", &a);
  12.  
  13.     if (a == 'n')
  14.         printf("종료 되었습니다.\n");
  15.     else if (a == 'y') {
  16.         printf("----------------------------\n");
  17.         for (i = 1; i <= seat; ++i)
  18.             printf("%d ", i);
  19.         printf("\n----------------------------\n");
  20.  
  21.         for (i = 0; i < seat; ++i)
  22.             printf("%d ", customer[i]);
  23.         printf("\n");
  24.  
  25.         printf("몇번째 좌석을 예약하시겠습니까? ");
  26.         scanf("%d", &b);
  27.  
  28.         customer[b-1] = 1;
  29.  
  30.         printf("예약되었습니다.\n");
  31.  
  32.         for (i = 0; i < seat; ++i)
  33.             printf("%d ", customer[seat]);
  34.        
  35.         printf("\n");
  36.  
  37.  
  38.     }
  39.  
  40.  
  41.  
  42.  
  43.     return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement