Answered step by step
Verified Expert Solution
Question
1 Approved Answer
in C++ A statistician is studying the sequence of numbers obtained by repeatedly tossing a six-sided number cube. On each side of the cube is
in C++
A statistician is studying the sequence of numbers obtained by repeatedly tossing a six-sided number cube. On each side of the cube is a single number in the range 1 to 6 inclusive, and no number is repeated on the cube. The statistician is particularly interested in runs of numbers. A run occurs when two or more consecutive tosses of the cube produce the same value. for example, in the following sequence of cube tosses, there are runs starting at position 1, 6, 12 and 14 Index 12345679 10 11 12 13 14 15 16 I7 Result5 4 3122 2 61 33 5 5 5 5 Write a program that creates an int array of 20 elements, would ask the user how many tosses are required (1-20), fills the array with the result of tossing a number cube as many times as requested by the user, prints the values of the tosses horizontally then displays the longest run found in the sequence of tosses. For the above example the output would be if the user requested 18 tosses: 0 12 3 45 6 7 8 9 10 11 12 13 14 15 16 17 The longest run occurs at index 14Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started