Question: C + + , VS Code! For example, This is a test; this test is only a test. will result in a string vector with

C++, VS Code!
For example, "This is a test; this test is only a test." will result in a string vector with elements "this", "is","a", "test", "only".
Mode -10 points
The number that appears the most times in a sequence is called the mode. Write a function named mode that takes a const reference
of integers as
an argument and returns the mode of the sequence of numbers inside the vector. Assume the input vector contains at least one number. If multiple modes
exist, break the ties by returning the smallest number.
Craps -10 points
These are the rules of a simple game of craps involving a pair of dice. Roll a pair of dice and sum the pair; this is the initial sum. The outcome of the game
is determined by the initial sum of the dice rolls as follows:
If the initial sum is 7 or 11, the player wins.
If the initial sum is 2,3, or 12, the house wins.
If the initial sum is 4,5,6,8,9, or 10, continue rolling until either the initial sum appears again or a 7 appears. If the initial sum appears first, the player
wins. If a 7 appears first, the house wins.
Suppose you have a special dice machine that outputs a predetermined sequence of dice rolls, represented by a vector of integers. The first two elements in
this vector would be the outcome of the first roll and so on.
Write a function named
that takes a
reference to a vector of integers and returns 0 when the player wins, 1 when the house wins, or 2
when more rolls are needed.
Ensure your code is robust against incorrect inputs by verifying that each element in the vector is within the 1-6 range of standard dice and output an error
(-1) if the inputs are invalid.
C + + , VS Code! For example, "This is a test;

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!