Ternary Operators in c++





This video tutorial explains the ternary operators available in c++.
You will lean what are the ternary operators and also how to use them in your program, how a ternary operator can be used as alternative to simple if and else in detail with examples.

source code for this tutorial

#include <iostream>

using namespace std;

int main()
{
    int mark;
    cout << "Enter your mark"<<endl;
    cin >> mark;

    mark >5 ? cout << "you are passed in exam" : cout << "you are failed in exam" ;

    return 0;
}