최대 1 분 소요

예제

  • 코드
    #include <iostream>

    using namespace std;

    int main() {
        int i = 1;
        if (i == 1) {
            cout << 1 << endl;
        } else if (i == 2) {
            cout << 2 << endl;
        } else {
            cout << "other" << endl;
        }

        switch (i) {
        case 1:
            cout << 1 << endl;
            break;
        case 2:
            cout << 2 << endl;
            break;
        default:
            cout << "other" << endl;
        }

        return 0;
    }
  • 실행 결과
    1
    1