jaybeau21

CardSum

Apr 24th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. void CardSum(int val1, int val2, int val3, int val4, int &total)
  2.  
  3. /*Takes the values of three cards as val1, val2, and val3, changes the value to 10 if a value is greater than 10, sums them, and outputs their totals
  4. val1 >= 0 && val1 <= 14, val2 >= 0 && val2 <= 14, val3 >= 0 && val3 <= 14, val4 >= 0 && val4 <= 14
  5. Returns the sum of the values as total*/
  6.  
  7. {
  8. if (val1 == 12 || val1 == 13 || val1 == 14)
  9. {
  10. val1 = 10;
  11. }
  12. if (val2 == 12 || val2 == 13 || val2 == 14)
  13. {
  14. val2 = 10;
  15. }
  16. if (val3 == 12 || val3 == 13 || val3 == 14)
  17. {
  18. val3 = 10;
  19. }
  20. if (val4 == 12 || val4 == 13 || val4 == 14)
  21. {
  22. val4 = 10;
  23. }
  24.  
  25. total = 0;
  26. total = val1 + val2 + val3 + val4;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment