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


C++ ios manipulators noboolapha()用法及代碼示例

C++中的流操縱器的noboolalpha()方法用於獲取指定str流的boolapha格式標誌的整數值。

用法:

ios_base& noboolalpha (ios_base& str)

參數:此方法接受str作為參數,這是為其獲取格式標誌的流。


返回值:此方法返回帶有noboolalpha格式標誌的流str。

範例1:

// C++ code to demonstrate 
// the working of noboolalpha() function 
  
#include <iostream> 
  
using namespace std; 
  
int main() 
{ 
  
    // Initializing the boolean flag 
    bool flag = true; 
  
    // Using noboolalpha() 
    cout << "noboolalpha flag:"
         << noboolalpha << flag << endl; 
  
    return 0; 
}
輸出:
noboolalpha flag:1

範例2:

// C++ code to demonstrate 
// the working of noboolalpha() function 
  
#include <iostream> 
  
using namespace std; 
  
int main() 
{ 
  
    // Initializing the boolean flag 
    bool flag = false; 
  
    // Using noboolalpha() 
    cout << "noboolalpha flag:"
         << noboolalpha << flag << endl; 
  
    return 0; 
}
輸出:
noboolalpha flag:0

參考: http://www.cplusplus.com/reference/ios/noboolalpha/



相關用法


注:本文由純淨天空篩選整理自guptayashgupta53大神的英文原創作品 ios manipulators noboolapha() function in C++。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。