DEV Community

Mahamadjon000
Mahamadjon000

Posted on

2 1 1 1 1

Relation operators.

Сегодня расскажу о Relation operator.

Relation operator - это сравнения двух значений.

Они позволяют выяснить два значения заданному условию.

Вот основные операторы:

  1. == - Равно.

2.!= - Не равно.

3.> - Больше.

4.< - Меньше.

5.>= - Больше или равно.

  1. <= - Меньше или равно.

Пример кода;

#include <iostream>

using namespace std;

int main()
{
int a = 5,b = 10;

cout << (a == b) << endl;
cout << (a != b)  << endl;
cout << (a > b) << endl;
cout << (a < b) << endl;
cout << (a >= b) << endl;
cout << (a <= b) << endl;

return 0;
}
Enter fullscreen mode Exit fullscreen mode

*Каждое выражение возвращает либо 1 либо 0 в зависимости от того выполняется ли условия. *

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more