편집 기록

편집 기록
  • 프로필 nowp님의 편집
    날짜2021.06.02

    c언어 while문 알려주십쇼


    이 코드에서 while문을 한번 돈다음에 다음 while문이 실행될때 가장 위의 문장이 실행이 되지 않고 바로 다음 코드가 실행됩니다. 실행된 뒤에 밑에것들이 실행되게 하려면 어떻게 해야하나요?

    #include <stdio.h>
    #define SIZE 10
    
    int main() {
        char c = 0;
        int weight = 0, height = 0;
        int theater[SIZE][SIZE] = { 0 };
    
        while (1) {
    
            printf("극장 좌석 예약 하시겠습니까?(y/n)");
            scanf_s("%c", &c);
    
            if (c == 'n')
                break;
    
                printf("예매가능좌석\n\n");
                printf("    1  2  3  4  5  6  7  8  9  10\n");
                printf("    -----------------------------\n");
                for (int i = 0; i < SIZE; i++) {
                    printf("%d|", i + 1);
                    for (int j = 0; j < SIZE; j++)
                        printf(" %d ", theater[i][j]);
                    printf("\n");
                }
    
                printf("\n예약좌석번호를 입력하세요:");
                scanf_s("%d %d", &weight, &height);
    
                if (weight <= 0 || weight > SIZE) {
                    printf("1~10 사이의 숫자를 입력해주세요");
                    continue;
                }
                if (theater[weight - 1][height - 1] == 0) {
                    theater[weight - 1][height - 1] = 1;
                    printf("예약되었습니다.\n");
                }
    
                else
                    printf("이미 예약되어있습니다. 다른 좌석을 선택해주세요.\n");
            }
    
        return 0;
    }
    
  • 프로필 알 수 없는 사용자님의 편집
    날짜2021.06.02

    c언어 while문 알려주십쇼


    이 코드에서 while문을 한번 돈다음에 다음 while문이 실행될때 가장 위의 문장이 실행이 되지 않고 바로 다음 코드가 실행됩니다. 실행된 뒤에 밑에것들이 실행되게 하려면 어떻게 해야하나요?

    include

    define SIZE 10

    int main() { char c = 0; int weight = 0, height = 0; int theater[SIZE][SIZE] = { 0 };

    while (1) {
    
        printf("극장 좌석 예약 하시겠습니까?(y/n)");
        scanf_s("%c", &c);
    
        if (c == 'n')
            break;
    
            printf("예매가능좌석\n\n");
            printf("    1  2  3  4  5  6  7  8  9  10\n");
            printf("    -----------------------------\n");
            for (int i = 0; i < SIZE; i++) {
                printf("%d|", i + 1);
                for (int j = 0; j < SIZE; j++)
                    printf(" %d ", theater[i][j]);
                printf("\n");
            }
    
            printf("\n예약좌석번호를 입력하세요:");
            scanf_s("%d %d", &weight, &height);
    
            if (weight <= 0 || weight > SIZE) {
                printf("1~10 사이의 숫자를 입력해주세요");
                continue;
            }
            if (theater[weight - 1][height - 1] == 0) {
                theater[weight - 1][height - 1] = 1;
                printf("예약되었습니다.\n");
            }
    
            else
                printf("이미 예약되어있습니다. 다른 좌석을 선택해주세요.\n");
        }
    
    return 0;
    

    }

  • 프로필 nowp님의 편집
    날짜2021.06.02

    c언어 while문 알려주십쇼


    #include <stdio.h>
    #define SIZE 10
    
    int main() {
        char c = 0;
        int weight = 0, height = 0;
        int theater[SIZE][SIZE] = { 0 };
    
        while (1) {
    
            printf("극장 좌석 예약 하시겠습니까?(y/n)");
            scanf_s("%c", &c);
    
            if (c == 'n')
                break;
    
                printf("예매가능좌석\n\n");
                printf("    1  2  3  4  5  6  7  8  9  10\n");
                printf("    -----------------------------\n");
                for (int i = 0; i < SIZE; i++) {
                    printf("%d|", i + 1);
                    for (int j = 0; j < SIZE; j++)
                        printf(" %d ", theater[i][j]);
                    printf("\n");
                }
    
                printf("\n예약좌석번호를 입력하세요:");
                scanf_s("%d %d", &weight, &height);
    
                if (weight <= 0 || weight > SIZE) {
                    printf("1~10 사이의 숫자를 입력해주세요");
                    continue;
                }
                if (theater[weight - 1][height - 1] == 0) {
                    theater[weight - 1][height - 1] = 1;
                    printf("예약되었습니다.\n");
                }
    
                else
                    printf("이미 예약되어있습니다. 다른 좌석을 선택해주세요.\n");
            }
    
        return 0;
    }
    

    이 코드에서 while문 가장 위의 문장이 실행된 뒤에 밑에 것들이 실행되게 하려면 어떻게 해야하나요?

  • 프로필 알 수 없는 사용자님의 편집
    날짜2021.06.02

    c언어 while문 알려주십쇼


    include

    define SIZE 10

    int main() { char c = 0; int weight = 0, height = 0; int theater[SIZE][SIZE] = { 0 };

    while (1) {
    
        printf("극장 좌석 예약 하시겠습니까?(y/n)");
        scanf_s("%c", &c);
    
        if (c == 'n')
            break;
    
            printf("예매가능좌석\n\n");
            printf("    1  2  3  4  5  6  7  8  9  10\n");
            printf("    -----------------------------\n");
            for (int i = 0; i < SIZE; i++) {
                printf("%d|", i + 1);
                for (int j = 0; j < SIZE; j++)
                    printf(" %d ", theater[i][j]);
                printf("\n");
            }
    
            printf("\n예약좌석번호를 입력하세요:");
            scanf_s("%d %d", &weight, &height);
    
            if (weight <= 0 || weight > SIZE) {
                printf("1~10 사이의 숫자를 입력해주세요");
                continue;
            }
            if (theater[weight - 1][height - 1] == 0) {
                theater[weight - 1][height - 1] = 1;
                printf("예약되었습니다.\n");
            }
    
            else
                printf("이미 예약되어있습니다. 다른 좌석을 선택해주세요.\n");
        }
    
    return 0;
    

    }

    이 코드에서 while문 가장 위의 문장이 실행된 뒤에 밑에것들이 실행되게 하려면 어떻게 해야하나요?