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

📅  最后修改于: 2021-05-30 07:36:11             🧑  作者: Mango

iswlower()是C / C++中的内置函数,它检查给定的宽字符是否为小写字符。它在C++的cwctype头文件中定义。

语法

int iswlower(ch)

参数:该函数接受单个强制性参数ch ,该参数指定宽字符,我们必须检查该宽字符是否为小写字符。

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

  • 如果参数ch是小写字符,则返回非零值。
  • 如果不是小写字符,则返回0。

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

程序1

// C++ program to illustrate
// iswlower() function
#include 
#include 
using namespace std;
  
int main()
{
  
    wchar_t ch1 = 'a';
    wchar_t ch2 = 'A';
  
    // Function to check if the character
    // is a lowercase character or not
    if (iswlower(ch1))
        wcout << ch1 << " is a lowercase character ";
    else
        wcout << ch1 << " is not a lowercase character ";
    wcout << endl;
  
    if (iswlower(ch2))
        wcout << ch2 << " is a lowercase character ";
    else
        wcout << ch2 << " is not a lowercase character ";
  
    return 0;
}
输出:
a is a lowercase character 
A is not a lowercase character

程序2

// C++ program to illustrate
// iswlower() function
#include 
#include 
using namespace std;
  
int main()
{
  
    wchar_t ch1 = 'q';
    wchar_t ch2 = '?';
  
    // Function to check if the character
    // is a lowercase character or not
    if (iswlower(ch1))
        wcout << ch1 << " is a lowercase character ";
    else
        wcout << ch1 << " is not a lowercase character ";
    wcout << endl;
  
    if (iswlower(ch2))
        wcout << ch2 << " is a lowercase character ";
    else
        wcout << ch2 << " is not a lowercase character ";
  
    return 0;
}
输出:
q is a lowercase character 
? is not a lowercase character
想要从精选的最佳视频中学习和练习问题,请查看《基础知识到高级C的C基础课程》。