"프로그래머스 12948 핸드폰 번호 가리기"의 두 판 사이의 차이

(새 문서: ==개요== {{프로그래머스|레벨=1|페이지=4|분류=연습문제}} ==C++== <syntaxhighlight lang='cpp'> #include <string> #include <vector> using namespace std; string solu...)
 
 
13번째 줄: 13번째 줄:
         phone_number[i] = '*';
         phone_number[i] = '*';
     }
     }
    return phone_number;
}
</syntaxhighlight>
<syntaxhighlight lang='cpp'>
#include <string>
#include <vector>
using namespace std;
string solution(string phone_number) {
    fill(phone_number.begin(), phone_number.end()-4, '*');
     return phone_number;
     return phone_number;
}
}
</syntaxhighlight>
</syntaxhighlight>

2024년 1월 2일 (화) 02:27 기준 최신판

1 개요[ | ]

프로그래머스 12948 핸드폰 번호 가리기

2 C++[ | ]

#include <string>
#include <vector>

using namespace std;

string solution(string phone_number) {
    for(int i=0; i<phone_number.length()-4; i++) {
        phone_number[i] = '*';
    }
    return phone_number;
}
#include <string>
#include <vector>

using namespace std;

string solution(string phone_number) {
    fill(phone_number.begin(), phone_number.end()-4, '*');
    return phone_number;
}
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}