N

(프로그래머스 c++)[PCCE 기출문제] 4번 / 병과분류 본문

프로그래머스 알고리즘/0 & 1단계

(프로그래머스 c++)[PCCE 기출문제] 4번 / 병과분류

naeunchan 2025. 7. 26. 15:13
728x90
반응형
 

https://school.programmers.co.kr/learn/courses/30/lessons/340204

 

프로그래머스

SW개발자를 위한 평가, 교육의 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프

programmers.co.kr

 

빈칸을 채워서 푸는 문제.

각 조건에 따라 출력되는 값이 다르게 나온다.

출력되는 값을 보고 조건을 넣어주면 된다.

#include <iostream>

using namespace std;

int main(void) {
    string code;
    cin >> code;
    string last_four_words = code.substr(code.size()-4, 4);
    if(last_four_words == "_eye") { // 빈칸
        cout << "Ophthalmologyc";
    }
    else if(last_four_words == "head") { // 빈칸
        cout << "Neurosurgery";
    }
    else if(last_four_words == "infl"){ // 빈칸
        cout << "Orthopedics";
    }
	else if (last_four_words == "skin") // 빈칸
	{
        cout << "Dermatology";
    }
	else // 빈칸
	{
        cout << "direct recommendation";
	}
    return 0;
}

 

728x90
반응형