[c++] Boj 1264 모음의 개수

zzzzwso·2023년 5월 9일
0

algorithm

목록 보기
2/22

대문자를 소문자로 변형하는 함수 -> tolower 사용

#include <iostream>
#include <string>
using namespace std;

int main()
{
	string s;
	while (1)
	{
		int cnt = 0;
		getline(cin, s);
		for (int i = 0; i < s.length(); i++)
		{
			s[i] = tolower(s[i]); //소문자로 변경
			if (s[i] == 'a' || s[i] == 'e' || s[i] == 'i' || s[i] == 'o' || s[i] == 'u')
				cnt++;
		}
		if (s == "#")
			break;
		cout << cnt << '\n';
	}
}
profile
HI there

0개의 댓글