Home »
C++ programs
iswupper() function in C++
C++ iswupper() function with Example: Here, we are going to learn about the iswupper() function of cwtype.h header file with example.
Submitted by Raja Sethupathi V, on February 01, 2019
The iswupper() function is defined in the header file <cwctype.h>.
Prototype:
int iswupper(wchar_t rs);
Parameter:
wchar_t rs – Checks the given character is in upper case or not.
Return type:
The function returns two values:
- Zero: if rs is non - uppercase character.
- Non Zero: if rs is uppercase character.
Use of function
The iswupper() is built-in function in C++, which is used to check the given character, rs is in uppercase or not .
Program 1:
#include <cwctype>
#include <iostream>
using namespace std;
int main() {
wchar_t rs1 = 'H';
wchar_t rs2 = 'e';
wchar_t rs3 = 'l';
wchar_t rs4 = 'P';
// Function to check if the character
// is a uppercase character or not
if (iswupper(rs1))
wcout << rs1 << " is a uppercase ";
else
wcout << rs1 << " is not a uppercase ";
wcout << endl;
if (iswupper(rs2))
wcout << rs2 << " is a uppercase ";
else
wcout << rs2 << " is not a uppercase ";
wcout << endl;
if (iswupper(rs3))
wcout << rs3 << " is a uppercase ";
else
wcout << rs3 << " is not a uppercase ";
wcout << endl;
if (iswupper(rs4))
wcout << rs4 << " is a uppercase ";
else
wcout << rs4 << " is not a uppercase ";
wcout << endl;
return 0;
}
Output
H is a uppercase
e is not a uppercase
l is not a uppercase
P is a uppercase
Program 2:
#include <cwctype>
#include <iostream>
using namespace std;
int main() {
wchar_t rs1 = '.';
wchar_t rs2 = 'C';
wchar_t rs3 = '@';
wchar_t rs4 = 'M';
// Function to check if the character
// is a uppercase character or not
if (iswupper(rs1))
wcout << rs1 << " is a uppercase ";
else
wcout << rs1 << " is not a uppercase ";
wcout << endl;
if (iswupper(rs2))
wcout << rs2 << " is a uppercase ";
else
wcout << rs2 << " is not a uppercase ";
wcout << endl;
if (iswupper(rs3))
wcout << rs3 << " is a uppercase ";
else
wcout << rs3 << " is not a uppercase ";
wcout << endl;
if (iswupper(rs4))
wcout << rs4 << " is a uppercase ";
else
wcout << rs4 << " is not a uppercase ";
wcout << endl;
return 0;
}
Output
. is not a uppercase
C is a uppercase
@ is not a uppercase
M is a uppercase