Advertisement
adnit

Untitled

Dec 7th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. int x = 5 / 2 + 1;
  2. // Switchi
  3. switch (x) {
  4. case 2: cout << "-1"; break;
  5. case 3: cout << "-2"; break;
  6. case 4: cout << "-3"; break;
  7. default: cout << "-4"; break;
  8. }
  9.  
  10. // ifi i njejt me switch
  11. if(x==2)
  12. {
  13. cout << "-1";
  14. } else if(x==3)
  15. cout << "-2";
  16. } else if(x==4)
  17. cout << "-3";
  18. } else
  19. {
  20. cout << "-4";
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement