Hi, I know this is a C++ forum and I'm writing code in C, however since C and C++ have similarities I would like to know your insights on my program and how could I improve it in order to address the tasks given on the assignment.
Dice Rolling: Write a program that simulates the rolling of 3 dice (x,y,z), consider that each dice can give 1-12 values. The program should use rand() three times to roll the first, second and third die respectively. The sum of the three values should then be calculated.
A) Consider the sum of the three dice values as the first winner.
eg. x+y+z -----> first winner.
B) Consider the sum of two dice and subtracting the third as the second winner.
eg. x+y+z = winning sum;
x+y-z ----> second winner // but I'm confused since x+y-z is not the only existing combination.
// I can also have: x+z - y or y+z -x How would I establish a difference between this cases and also is there a way to check which combination is going to occur first?
C) Any negative value player has to pay double amount ----> Here I'm lost (Never played dice rolling maybe that's why I have no clue what it means) Does it has to do with the question B) ?
D) On a 3600 trial, map the most possible, and the least possible winning values for the first and second player. ----> I think they talk about the matrix for 2 dice the most possible winning value would be 7 and the least possible would be 2 and 12. Should I make a matrix and get the values?