Uploaded by levi evans

ECE 102 Assignment: Pig Game Simulation

advertisement
ECE 102
Assignment #18
Write a program that simulates the play of one turn in the game of pig. At the end of
the turn, the score for the turn should be displayed.
Prelab:
1. Write down the first two steps of problem solving for one turn. The dice
value is not an user input, but rather is generated using rand()%6+1;
2. Write a detailed pseudocode. Hint: a running sum is needed to in order to
get the score for the turn. Review the notes on how to calculate a running
sum.
3. Trace the pseudocode with random values that you pick. Do this twice. One
trace should be terminated by user input of ‘n’, the other trace by letting the
dice = 1.
4. Try your best to fix the pseudocode to make sure that it works correctly
before writing the program.
Download