c:if not eq
"not_eq" is an inbuilt keyword that has been around since at least C++98. It is an alternative to != (NOT EQUAL TO) operator and it mostly uses with the conditions.
“ not_eq”是一个内置关键字,至少从C ++ 98起就存在。 它是!= ( NOT EQUAL TO )运算符的替代方法,它通常与条件一起使用。
The not_eq keyword returns 1 if operand_1 is not equal to the operand_1, and it returns 0 if operand_1 is equal to the operand_2.
所述NOT_EQ关键字返回1,如果是operand_1不等于operand_1,并且如果operand_1等于operand_2它返回0。
Syntax:
句法:
operand_1 not_eq operand 2;
Here, operand_1 and operand_2 are the operands.
在这里,操作数_1和操作数_2是操作数。
Example:
例:
Input:
a = 10;
b = 20;
result = a not_eq b;
Output:
result = 1
C ++示例演示“ not_eq”关键字的用法 (C++ example to demonstrate the use of "not_eq" keyword)
// C++ example to demonstrate the use of
// 'not_eq' operator.
#include <iostream>
using namespace std;
int main()
{
int a = 10;
int b = 20;
cout << "a: " << a << endl;
cout << "b: " << b << endl;
if (a not_eq b)
cout << a << " is not equal to " << b << endl;
else
cout << a << " is equal to " << b << endl;
a = 20;
b = 20;
cout << "a: " << a << endl;
cout << "b: " << b << endl;
if (a not_eq b)
cout << a << " is not equal to " << b << endl;
else
cout << a << " is equal to " << b << endl;
return 0;
}
Output:
输出:
a: 10
b: 20
10 is not equal to 20
a: 20
b: 20
20 is equal to 20
翻译自: https://www.includehelp.com/cpp-tutorial/not_eq-keyword-with-example.aspx
c:if not eq