c++ cdi+示例_C ++'not'关键字和示例
生活随笔
收集整理的這篇文章主要介紹了
c++ cdi+示例_C ++'not'关键字和示例
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
c++ cdi+示例
"not" is an inbuilt keyword that has been around since at least C++98. It is an alternative to ! (Logical NOT) operator and it mostly uses with the conditions.
“ not”是一個內置關鍵字,至少從C ++ 98起就存在。 它是替代! ( 邏輯非 )運算符,它通常與條件一起使用。
The not keyword returns 1 if the result of the given condition is 0, and it returns 0 if the result of the given condition is 1.
如果給定條件的結果為0,則not關鍵字返回1;如果給定條件的結果為1,則not返回0。
Syntax:
句法:
not operand;Here, operand is the operand.
在此, 操作數是操作數。
Example:
例:
Input:a = 10;b = 20;result = not(a < b);Output:result = 1C ++示例演示“ not”關鍵字的用法 (C++ example to demonstrate the use of "not" keyword)
// C++ example to demonstrate the use of // 'not' operator.#include <iostream> using namespace std;int main() {int num = 20;if (not(num >= 10 and num <= 50))cout << "true\n";elsecout << "false\n";if (not(num >= 20 and num <= 50))cout << "true\n";elsecout << "false\n";if (not(num > 50 and num <= 100))cout << "true\n";elsecout << "false\n";return 0; }Output:
輸出:
false false true翻譯自: https://www.includehelp.com/cpp-tutorial/not-keyword-with-example.aspx
c++ cdi+示例
總結
以上是生活随笔為你收集整理的c++ cdi+示例_C ++'not'关键字和示例的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 补牙缝多少钱啊?
- 下一篇: c++ cdi+示例_C ++“和”关键