Advertisement
Felanpro

Conditional (ternary) operator

Mar 20th, 2016
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.21 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     unsigned int y; //You don't have to use unsigned I just use it to save data!
  7.  
  8.     1<2 ? y = 2 : y = 3;
  9.  
  10.     cout << y << endl;
  11.  
  12.     return 0;
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement