#include <string>
#include <cstring>
#include <vector>
using namespace std;
bool solution(string s) {
     if (s.length() == 4 || s.length() == 6)
     {
          char* arr = new char[s.length() + 1];
          strcpy(arr, s.c_str());    //문자열 char배열로 변환
          for (int i = 0; i < s.length(); i++)
               if (isdigit(arr[i]) == 0)
                    return false;
          return true;
     }
     else
          return false;
}'코딩테스트 > 프로그래머스' 카테고리의 다른 글
| [Level 1][C++] 같은 숫자는 싫어 (0) | 2024.10.10 | 
|---|---|
| [Level 1][C++] 자연수 뒤집어 배열로 만들기 (0) | 2024.10.10 | 
| [Level 1][C++] 소수 찾기 (0) | 2024.10.10 | 
| [Level 1][C++] 소수의 합 (1) | 2024.10.10 | 
| [Level 2][C++] 기능개발 (2) | 2024.10.10 |