DEV Community

Mahamadjon000
Mahamadjon000

Posted on

1

Conditional operator.

Conditional operator - Условное оператор (turnery operator) используется выбор между двумя значениями на основе условия.

Syntax of turnery

Condition ? A : B;

Примеры использования:

#include <iostream>

using namespace std;

int main()
{

int a = 5,b = 10;

int max = (a > b) << endl;

cout << "MAX NUMBER" << endl;


return 0;
}
Enter fullscreen mode Exit fullscreen mode

Здесь если a больше b переменной max присваивается a иначе — b.

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