Posts [프로그래머스] 핸드폰 번호 가리기 / C++
Post
Cancel

[프로그래머스] 핸드폰 번호 가리기 / C++


Contents



문제


문제를 보시려면 링크를 클릭해주세요.


풀이


아주 간단히 풀 수 있는 문제입니다.

전화번호의 뒷 4자리를 뺀 나머지를 *로 바꿔주면 됩니다.


소스 코드


1
2
3
4
5
6
7
8
9
10
11
12
#include <string>

using namespace std;

string solution(string phone_number) {
    
    for(int i=0; i<phone_number.size()-4; i++){
        phone_number[i] = '*';
    }
    
    return phone_number;
}



This post is licensed under CC BY 4.0 by the author.

[프로그래머스] 하샤드 수 / C++

[프로그래머스] 콜라츠 추측 / C++

Comments powered by Disqus.