當前位置: 首頁>>代碼示例 >>用法及示例精選 >>正文


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++。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。