본문 바로가기
문제 해결/BaekJoon

[백준] [C++] 15000번 CAPS

by WSLim_97 2022. 11. 18.
반응형

https://www.acmicpc.net/problem/15000

 

15000번: CAPS

Earth is under attack! Messages need to be sent to the Earth Defense Force (EDF) that makes clear that the situation is dire. The EDF’s strongest forces consist of mechs (huge bipedal robots) that are piloted by Japanese teenagers. To make sure that the

www.acmicpc.net


코드

#include <iostream>
using namespace std;

int main() {
	string str;
	cin >> str;

	for (int i = 0; i < str.size(); i++) {
		str[i] = toupper(str[i]);
	}

	cout << str;

	return 0;
}

풀이

알파벳 문자열을 입력받아 소문자는 대문자로 변환하여 출력하는 문제이다.

 

string형으로 문자열을 입력받은 뒤 toupper 함수를 사용하면 소문자를 대문자로 변활 할 수 있다.

반응형