c++

코딩테스트/프로그래머스(C++)_Level.0

[프로그래머스/C++] Lv.0 문자열이 몇 번 등장하는지 세기

문제 코드 #include using namespace std; int solution(string myString, string pat) { int answer = 0; for (int i = 0; i < myString.length(); ++i) { if (myString.substr(i, pat.size()) == pat) { ++answer; } } return answer; }

코딩테스트/프로그래머스(C++)_Level.0

[프로그래머스/C++] Lv.0 특정한 문자를 대문자로 바꾸기

문제 코드 #include using namespace std; string solution(string my_string, string alp) { string answer = ""; for (auto& c : my_string) { if (c == alp[0]) { c = toupper(c); } } return my_string; }

코딩테스트/프로그래머스(C++)_Level.0

[프로그래머스/C++] Lv.0 A 강조하기

문제 코드 #include #include #include using namespace std; string solution(string myString) { string answer = ""; for (char& c : myString) { if (c == 'a') { c = 'A'; } else if (c != 'A') { c = tolower(c); } } return myString; }

코딩테스트/프로그래머스(C++)_Level.0

[프로그래머스/C++] Lv.0 배열에서 문자열 대소문자 변환하기

문제 코드 #include #include #include using namespace std; vector solution(vector strArr) { vector answer; for (int i = 0; i < strArr.size(); ++i) { if (i & 1) { transform(strArr[i].begin(), strArr[i].end(), strArr[i].begin(), ::toupper); } else { transform(strArr[i].begin(), strArr[i].end(), strArr[i].begin(), ::tolower); } } return strArr; }

코딩테스트/프로그래머스(C++)_Level.0

[프로그래머스/C++] Lv.0 소문자로 바꾸기

문제 코드 #include #include #include #include using namespace std; string solution(string myString) { transform(myString.begin(), myString.end(), myString.begin(), ::tolower); return myString; }

코딩테스트/프로그래머스(C++)_Level.0

[프로그래머스/C++] Lv.0 대문자로 바꾸기

문제 코드 #include #include using namespace std; string solution(string myString) { string answer = ""; transform(myString.begin(), myString.end(), myString.begin(), ::toupper); return myString; }

mane
'c++' 태그의 글 목록 (10 Page)