![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
iswupper() function in C++ STL
In this article we are going to discuss the iswupper() function in C++, its syntax, working and its return values.
iswupper() function is an inbuilt function in C++ which is defined in header file. The function checks whether the passed wide character is in upper case(A-Z) or not.This function is a wide character equivalent of isupper(), which means it works the same as isupper() the difference is it supports a wide character. The function checks the if argument passed is upper case(A-Z) then return a non-zero integer value(true), else return zero(false)
Syntax
int iswupper(wint_t ch);
The function accepts only one parameter, i.e. a wide character which is to be checked. The argument is casted in wint_t or WEOF.
wint_t stores an integral type of data.
Return value
The function returns an integer value, which can be either 0 (in case of false) or any non-zero value(in case of true).
Example
#include <iostream> #include <cwctype> using namespace std; int main() { wint_t a = 'A'; wint_t b = 'a'; wint_t c = 'B'; iswupper(a)?cout<<"\nIts upper case character":cout<<"\nNot upper case character"; iswupper(b)?cout<<"\nIts upper case character":cout<<"\nNot upper case character"; iswupper(c)?cout<<"\nIts upper case character":cout<<"\nNot upper case character"; }
Output
If we run the above code it will generate the following output −
Its upper case character Not upper case character Its upper case character
Example
#include <iostream> #include <cwctype> using namespace std; int main () { int i, count; wchar_t s[] = L"I aM VisItinG TutOriAls PoInT"; count = i = 0; while (s[i]) { if(iswupper(s[i])) count++; i++; } cout<<"There are "<<count <<" uppercase characters.\n"; return 0; }
Output
If we run the above code it will generate the following output −
There are 11 uppercase characters.