1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include <stdio.h>
#include <windows.h>
#include <stdlib.h>
#define COL GetStdHandle(STD_OUTPUT_HANDLE)
#define HIG_GREEN SetConsoleTextAttribute(COL, 0x000a); //콘솔창글씨 연두색
#define SKY_BLUE SetConsoleTextAttribute(COL, 0x000b); //콘솔창 글씨 하늘색
#define GREY SetConsoleTextAttribute(COL, 0x0008); //콘솔창 글씨 회색
int main(void)
{
    int a; //첫번째 정수
    int b; //두번째 정수
    int num1; //연산방법 
    int yesorno; //또 이용?
    int yesorno2; //콘솔창 cls
    cal:
    HIG_GREEN printf("콘솔창을 지우시겠습니까? 1.yes 2.no \n");
    scanf("%d", &yesorno2);
    if(yesorno2==1)
        system("cls");
    else if(yesorno2==2)
        goto cal2;
    cal2:
    SKY_BLUE printf("정수 2개를 입력해주세요 \n");
    scanf("%d", &a);
    scanf("%d", &b);
    HIG_GREEN printf("원하시는 연산을 선택해주세요. \n1.덧셈 2.뺄셈 3.곱셈 4.나눗셈\n");
    scanf("%d", &num1);
    switch(num1) //조건문 switch
    {
        case 1:
            HIG_GREEN printf("합 : %d \n", a+b);
            break;
        case 2:
            HIG_GREEN printf("차 : %d \n", a-b);
            break;
        case 3:
            HIG_GREEN printf("곱 : %d \n", a*b);
            break;
        case 4:
            HIG_GREEN printf("몫 나머지 : %d %d \n", a/b, a%b);
            break;
        default :
            HIG_GREEN printf("없는 연산입니다. \n");
            break;
    }
    SKY_BLUE printf("더 이용하시겠습니까? \n1.yes 2.no \n");
    scanf("%d", &yesorno);
    if(yesorno==1)
        goto cal;
    else if(yesorno==2)
        GREY printf("이용해주셔서 감사합니다 \n");
    system("pause"); //콘솔창정지
        return 0;
}
cs

내가 진짜 힘들게 이거 만들었는데 '콘솔창을 지우겠습니까?' 이거 처음에는 실행안되게 하는법좀 가르쳐줘 ㅠㅠ