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)

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay