- 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
iswprint( ) in C++
We are given with the task to show the working of iswprint( ). The iswprint( ) function in C++ STL is used to check that whether the given wide character can be printed or not. It is a function present in cwctype header file in C++. Wide characters is a computer character datatype that generally has a size greater than the traditional 8-bit character.
Syntax
int iswprint(c);
Parameter
c – This is a parameter which specifies the wide character that has to be checked whether it is printable or not.
Return Value
This function returns a non-zero value if c can be printed. It will return zero if c cannot be printed.
Following characters given below are printable −
Upper case letters − A - Z
Lowercase letters − a - z
Digits − 0 - 9
Punctuation character − ! ” @ # $ % ^ & * ( ) } | \ ] [ _ - + ’ ? / . , } : ; ~ `
Space − ……
intable or not.
Example
#include <cwchar.h> #include<iostream.h> #inlude<cwctype.h> Using namespace std; int main( ){ wchar_t str[ ] = “ authorized<channel<partners”; wcout<<str; for( int i = 0; i < wcslen(str); i++){ if ( !iswprint(str[i])) str[i] = ‘ @ ’; } wcout<<str; return 0; }
Output
If we run above code it will generate the following output
authorized<channel<partners authorised@channel@partners
Example
#include <cwchar.h> #include<iostream.h> #inlude<cwctype.h> Using namespace std; int main( ){ wchar_t str[ ] = “ and I am<= Iron Man”; wcout<<str; for( int i = 0; i < wcslen(str); i++){ if ( !iswprint(str[i])) str[i] = ‘ & ’; } wcout<<str; return 0; }
Output
if we run above code it will generate the following output
and I am<= Iron Man and I am &&Iron Man