Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- int main()
- {
- bool goodJob{ false };
- int salary{ 100 };
- const int goodBonus{ 50 };
- const int badBonus{ -10 };
- //int bonus{0};
- std::cout << "Does job made good? yes - 1 / no - 0\n";
- std::cin >> goodJob;
- //if (goodJob)
- //{
- // bonus = goodBonus;
- //}
- //else
- //{
- // bonus = badBonus;
- //}
- // expr1 ? ifTrue : ifFalse
- //goodJob ? bonus = goodBonus : bonus = badBonus;
- //bonus = goodJob ? goodBonus : badBonus;
- salary += goodJob ? goodBonus : badBonus;
- std::cout << "Your salary is: " << salary << '\n';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement