오늘은 코드 카타를 1개 제출하고 팀 프로젝트에 대하여 개인적으로 진행하기로 하고 기획을 조금 해봤다.
숫자 문자열과 영단어
임시 문자열 누적과 if/else문으로 직접 비교하는 방식을 택했다.
#include <string>
#include <cctype>
using namespace std;
int solution(string s)
{
string ans = "";
string word = "";
for (char c : s)
{
if (isdigit(static_cast<unsigned char>(c)))
{
ans += c;
}
else
{
word += c;
if (word == "zero") { ans += '0'; word = ""; }
else if (word == "one") { ans += '1'; word = ""; }
else if (word == "two") { ans += '2'; word = ""; }
else if (word == "three") { ans += '3'; word = ""; }
else if (word == "four") { ans += '4'; word = ""; }
else if (word == "five") { ans += '5'; word = ""; }
else if (word == "six") { ans += '6'; word = ""; }
else if (word == "seven") { ans += '7'; word = ""; }
else if (word == "eight") { ans += '8'; word = ""; }
else if (word == "nine") { ans += '9'; word = ""; }
}
}
return stoi(ans);
}
슈터 게임 프로젝트 컨셉 기획-1일차
PVE 컨셉으로 만들 생각이다.
슈터게임은 익숙치 않아서 아직은 생각나는 게 많지 않지만, 이것을 시작으로 아이디어를 늘리고 개발할 것이다.
'TIL' 카테고리의 다른 글
| 2/10일자 TIL (0) | 2026.02.10 |
|---|---|
| 2/09일자 TIL (0) | 2026.02.09 |
| 2/05일자 TIL (0) | 2026.02.05 |
| 2/04일자 TIL (0) | 2026.02.04 |
| 2/03일자 TIL (0) | 2026.02.03 |