"프로그래머스 181875 배열에서 문자열 대소문자 변환하기"의 두 판 사이의 차이

1번째 줄: 1번째 줄:
==개요==
==개요==
{{프로그래머스|레벨=0|페이지=4}}
{{프로그래머스|레벨=0|페이지=4}}
[[분류: 코딩테스트 대소문자]]


==C++==
==C++==

2023년 9월 17일 (일) 17:19 판

1 개요

프로그래머스 181875 배열에서 문자열 대소문자 변환하기

2 C++

#include <string>
#include <vector>

using namespace std;

vector<string> solution(vector<string> strArr) {
    for(int i=0; i<strArr.size(); i++) {
        if(i%2==0) {
            for(char& ch: strArr[i]) ch = tolower(ch);
        } else {
            for(char& ch: strArr[i]) ch = toupper(ch);
        }
    }
    return strArr;
}
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}