当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


C++ iswupper()用法及代码示例


iswupper()是C /C++中的内置函数,该函数检查给定的宽字符是否为大写字符。它在CPP头文件中定义,并且此函数与isupper()。

用法:

int iswupper(wint_t rs)

参数:该函数接受单个强制性参数rs,该参数指定要检查的宽字符。


返回值:该函数返回两个值,如下所示:

  • 非零值-如果rs具有大写字符
  • -如果rs没有大写字符

以下示例程序旨在说明上述函数。
程序1:

// C++ program to illustrate 
// iswupper() function 
#include <bits/stdc++.h> 
using namespace std; 
int main() 
{ 
  
    wchar_t rs1 = 'S'; 
    wchar_t rs2 = 's'; 
  
    // Function to check if the character 
    // is a uppercase character or not 
    if (iswupper(rs1)) 
        wcout << rs1 << " is a uppercase character "; 
    else
        wcout << rs1 << " is not a uppercase character "; 
    wcout << endl; 
  
    if (iswupper(rs2)) 
        wcout << rs2 << " is a uppercase character "; 
    else
        wcout << rs2 << " is not a uppercase character "; 
  
    return 0; 
}
输出:
S is a uppercase character 
s is not a uppercase character

程序2:

// C++ program to illustrate 
// iswupper() function 
#include <bits/stdc++.h> 
using namespace std; 
int main() 
{ 
  
    wchar_t rs1 = 'R'; 
    wchar_t rs2 = '@'; 
  
    // Function to check if the character 
    // is a uppercase character or not 
    if (iswupper(rs1)) 
        wcout << rs1 << " is a uppercase character "; 
    else
        wcout << rs1 << " is not a uppercase character "; 
    wcout << endl; 
  
    if (iswupper(rs2)) 
        wcout << rs2 << " is a uppercase character "; 
    else
        wcout << rs2 << " is not a uppercase character "; 
  
    return 0; 
}
输出:
R is a uppercase character 
@ is not a uppercase character


相关用法


注:本文由纯净天空筛选整理自rajasethupathi大神的英文原创作品 iswupper() function in C/C++。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。