code.cpp 414 B

123456789101112
  1. /* Create a function that takes in three arguments (prob, prize, pay)
  2. and returns true if prob * prize > pay; otherwise return false.
  3. To illustrate, profitableGamble(0.2, 50, 9) should yield true, since
  4. the net profit
  5. is 1 (0.2 * 50 - 9), and 1 > 0. */
  6. bool profitableGamble(float prob, int prize, float pay) {
  7. return (prob * prize > pay);
  8. //if (prob * prize > pay) {return true;}
  9. //else{return false;}
  10. }