c:if not eq_C ++'not_eq'关键字和示例

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值