我们承担了展示iswprint()工作的任务。C ++ STL中的iswprint()函数用于检查是否可以打印给定的宽字符。它是C ++中cwctype头文件中提供的功能。宽字符是一种计算机字符数据类型,其大小通常大于传统的8位字符。
int iswprint(c);
c –这是一个参数,它指定必须检查的宽字符是否可打印。
如果可以打印c,则此函数返回非零值。如果无法打印c,它将返回零。
以下给出的以下字符可打印-
大写字母-A-Z
小写字母-a -z
数字- 0 - 9
标点符号-!” @#$%^&*()} | \] [_-+'?/。,}:; 〜`
空间-……
不稳定与否。
#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;
}输出结果
如果我们运行上面的代码,它将生成以下输出
authorized<channel<partners authorised@channel@partners
#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;
}输出结果
如果我们运行上面的代码,它将生成以下输出
and I am<= Iron Man and I am &&Iron Man