Advertisement
Felanpro

Ternary Operator

Jan 19th, 2016
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.22 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <string>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     //variable = (condition) ? true : false;
  9.  
  10.     int randomNum = (5 > 2) ? 5 : 2;
  11.  
  12.     cout << randomNum << endl;
  13.  
  14.     return 0;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement