C++ 本地化庫 - isprint



描述

它檢查字元是否可列印,可列印字元是指在顯示器上佔據列印位置的字元。

宣告

以下是 std::isprint 的宣告。

C++98

int isprint ( int c );

C++11

int isprint ( int c );

引數

c − 要檢查的字元,轉換為 int 型別,或 EOF。

返回值

它返回一個非零值。

異常

無異常保證 − 此函式從不丟擲異常。

示例

以下示例演示了 std::isprint 的用法。

#include <stdio.h>
#include <ctype.h>
int main () {
   int i=0;
   char str[]="Tutorialspoint.com \n sairamkrishna Mammahe \n";
   while (isprint(str[i])) {
      putchar (str[i]);
      i++;
   }
   return 0;
}

示例輸出應如下所示:

Tutorialspoint.com  
locale.htm
廣告

© . All rights reserved.