// READ THE GIANT COMMENT BELOW!!!!!!!!!!!
/*
Name:
Date:
Description:
*/
#include<iostream>
// You need additional includes!
using namespace std;
int main()
{
return 0;
}
/************************************************************************
PROGRAMMING PART OF 2007-2008 C++1 Final Examination
----------------------------------------------------
For the practical portion of the final exam you will
be following pseudocode to write a dice game. All the
files you need are in the project. You need
only write code in this file. Please write all your
code ABOVE this block of comments. Suggested procedure:
Document this file with your name, date and program
description. Be careful of your style
Write your include statements
Write your main program
!!!!Compile frequently!!!!
Paste output from one winning game and one losing game
at the end of your code (even if not completely finished)
======================================================================
THE GAME
--------
You are rolling three 6 sided dice. You bet 1.00.
When you roll the dice the first time, total the value on each
die and remember that number. Each round you add the value of the dice
together. If the new total is more than the original total, then you
double your bet. If the new total is less, you half the bet.
The game is over when you have the same total as the original roll.
======================================================================
PSEUDOCODE
----------
create three dice
roll each die (store in d1Value, etc.)
set total to d1Value + d2Value + d3Value
print out the total for this game
set the bet to 1.00
set newTotal to zero
print headings for table
[use setw() --- 8, 10, 10, 10, 10, 15 works well]
[remember you need to include iomanip for setw()]
while newTotal is not equal to total
roll each die
total the values
if newTotal < total then bet equals bet/2
else if newTotal > Total then bet equals 2*bet
print out the values, the newTotal and the bet
print out the final winnings and how much you won or lost
The value to beat is 12
Dice 1 Dice 2 Dice 3 Total Winnings
3 1 6 10 0.5
3 4 4 11 0.25
6 1 4 11 0.125
6 4 4 14 0.25
3 6 5 14 0.5
5 1 2 8 0.25
2 5 3 10 0.125
4 1 3 8 0.0625
4 1 4 9 0.03125
1 4 1 6 0.015625
5 2 4 11 0.0078125
2 4 1 7 0.00390625
2 4 4 10 0.00195312
1 1 3 5 0.000976562
1 4 5 10 0.000488281
2 6 6 14 0.000976562
5 3 4 12 0.000976562
GAME OVER!!
You lost 0.999023 dollars
**********************************************************
The value to beat is 10
Dice 1 Dice 2 Dice 3 Total Winnings
1 6 2 9 0.5
4 6 3 13 1
3 3 1 7 0.5
6 2 6 14 1
2 6 1 9 0.5
3 6 6 15 1
6 2 2 10 1
GAME OVER!!
You broke even
***********************************************************
The value to beat is 9
Dice 1 Dice 2 Dice 3 Total Winnings
5 5 1 11 2
3 4 1 8 1
6 6 4 16 2
4 3 4 11 4
3 2 3 8 2
3 4 1 8 1
6 2 2 10 2
6 1 1 8 1
6 5 2 13 2
4 5 5 14 4
1 3 4 8 2
4 2 4 10 4
5 2 5 12 8
4 4 3 11 16
1 1 4 6 8
5 2 3 10 16
1 2 6 9 16
GAME OVER!!
You won 15 dollars
EXTRA CREDIT
Write this separately by doing a Save As under File. Call the new file
extraCredit.cpp. Play 30 games (rounds). Do not output any individual rolls,
rather keep track of the number of times the total was higher
for each round. Output a table with the results of each round and the
total winnings
Round Times Higher Winnings this round Total winnings
************************************************************/