Computer >> 컴퓨터 >  >> 프로그램 작성 >> C 프로그래밍

C/C++의 towupper() 함수

<시간/>

iswupper() 함수는 C/C++의 내장 함수입니다. 와이드 문자를 대문자로 변환합니다. C++ 언어에서는 "cwctype" 헤더 파일에 선언되고 C 언어에서는 "ctype.h"로 선언됩니다. 와이드 문자로 알려진 단일 문자가 필요합니다. 문자가 대문자이면 그 문자로 변환되고, 그렇지 않으면 수정이 발생하지 않습니다.

다음은 C++ 언어의 towupper() 구문입니다.

wint_t towupper( wint_t ch );

다음은 C++ 언어로 된 towupper()의 예입니다.

예시

#include <cwchar>
#include <cwctype>
#include <iostream>
using namespace std;
int main() {
   wchar_t s[] = L"hello world!";
   wcout << L"The uppercase string":
   << L"\"is ";
   for (int i = 0; i < wcslen(s); i++)
   putwchar(towupper(s[i]));
   return 0;
}

출력

The uppercase string : HELLO WORLD!