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)

👋 Kindness is contagious

Engage with a sea of insights in this enlightening article, highly esteemed within the encouraging DEV Community. Programmers of every skill level are invited to participate and enrich our shared knowledge.

A simple "thank you" can uplift someone's spirits. Express your appreciation in the comments section!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found this useful? A brief thank you to the author can mean a lot.

Okay