#include#include<"/> #include#include<">

Home  >  Article  >  Backend Development  >  In C/C++, towupper() function

In C/C++, towupper() function

WBOY
WBOYforward
2023-08-29 12:01:061016browse

In C/C++, towupper() function

The function iswupper() is a built-in function in C/C. It converts wide characters to uppercase characters. The C language is declared in the "cwctype" header file, and the C language is declared in the "ctype.h" header file. It takes a single character, called a wide character. If the character is uppercase, it is converted to uppercase, otherwise no modification occurs.

The following is the syntax of towupper() in C language,

wint_t towupper( wint_t ch );

Here is an example of towupper() in C language,

Example

#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;
}

Output

The uppercase string : HELLO WORLD!

The above is the detailed content of In C/C++, towupper() function. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete