How to use conditional ternary operator with cout in C++

1 Answer

0 votes
#include <iostream>

using namespace std;

int main() {
    int a = 8, b = 3;

    cout << (a > b ? "yes" : "no") << endl;

    cout << (a == b ? "yes" : "no");
}



/*
run:

yes
no

*/

 



answered Sep 24, 2019 by avibootz
...