Answered step by step
Verified Expert Solution
Link Copied!

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++

image text in transcribed

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 14

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database Foundations Technology Fundamentals For IT Success

Authors: Bob Bryla

1st Edition

0782143725, 9780782143720

More Books

Students also viewed these Databases questions