📜  C / C++中的iswupper()函数

📅  最后修改于: 2021-05-26 02:50:07             🧑  作者: Mango

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

句法:

int iswupper(wint_t rs)

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

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

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

下面的程序说明了上述函数。
程序1:

// C++ program to illustrate
// iswupper() function
#include 
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 
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
要从最佳影片策划和实践问题去学习,检查了C++基础课程为基础,以先进的C++和C++ STL课程基础加上STL。要完成从学习语言到DS Algo等的更多准备工作,请参阅“完整面试准备课程”