Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ (Pattern recognition: consecutive four equal numbers) Rewrite the isConsecutiveFour function in Programming Exercise 8.21 using a vector as follows: bool isConsecutiveFour(const vector > &

C++

(Pattern recognition: consecutive four equal numbers)

Rewrite the isConsecutiveFour function in Programming Exercise 8.21 using a vector as follows:

bool isConsecutiveFour(const vector > & values)

Write a test program like the one in Programming Exercise 8.21.

Sample Run 1

Enter row size: 6

Enter column size: 7

0 1 0 3 1 6 1

0 1 6 8 6 0 1

5 6 2 1 8 2 9

6 5 6 1 1 9 1

1 3 6 1 4 0 7

3 3 3 3 4 0 7

The array has consecutive fours

Sample Run 2

Enter row size: 6

Enter column size: 7

0 1 0 3 1 6 1

0 1 6 8 6 0 1

5 6 2 1 8 2 9

6 5 6 1 1 9 1

1 3 6 1 4 0 7

5 5 5 3 4 0 7

The array does not have consecutive fours

Picture of programming assingnment 8.21

image text in transcribed

Note this time it is asking to use vectors

*8.21 (Pattern recognition: consecutive four equal numbers) Write the following function that tests whether a two-dimensional array has four consecutive numbers of the same value, either horizontally, vertically, or diagonally. bool sConsecutive Four (int values [ ] [ 7 ] ) Write a test program that prompts the user to enter the number of rows and columns of a two-dimensional array and then the values in the array and displays true if the array contains four consecutive numbers with the same value. Otherwise, display false. Here are some examples of the true cases: 0 168 60 5 6 2 1 8 2 9 6 5 6 119 1 1 3 6 1 4 07 3 3 33 4 0 7 0 1 0 316 1 0 1 68 6 0 5 5 2 1 8 2 9 6 5 6 1191 1 5 6 1 4 07 3 5 3 3 40 7 01 0 316 1 0 16 8 60 5 6 2 1 6 2 9 6 5 6 6 19 1 3 6 1 4 07 3 6 3 3 40 7 01 0 31 6 1 0168 6 0 96 2 1 8 2 9 69 6 119 1 1 39 1 4 07 3 3 3 940 7 *8.21 (Pattern recognition: consecutive four equal numbers) Write the following function that tests whether a two-dimensional array has four consecutive numbers of the same value, either horizontally, vertically, or diagonally. bool sConsecutive Four (int values [ ] [ 7 ] ) Write a test program that prompts the user to enter the number of rows and columns of a two-dimensional array and then the values in the array and displays true if the array contains four consecutive numbers with the same value. Otherwise, display false. Here are some examples of the true cases: 0 168 60 5 6 2 1 8 2 9 6 5 6 119 1 1 3 6 1 4 07 3 3 33 4 0 7 0 1 0 316 1 0 1 68 6 0 5 5 2 1 8 2 9 6 5 6 1191 1 5 6 1 4 07 3 5 3 3 40 7 01 0 316 1 0 16 8 60 5 6 2 1 6 2 9 6 5 6 6 19 1 3 6 1 4 07 3 6 3 3 40 7 01 0 31 6 1 0168 6 0 96 2 1 8 2 9 69 6 119 1 1 39 1 4 07 3 3 3 940 7

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

Current Trends In Database Technology Edbt 2006 Edbt 2006 Workshops Phd Datax Iidb Iiha Icsnw Qlqp Pim Parma And Reactivity On The Web Munich Germany March 2006 Revised Selected Papers Lncs 4254

Authors: Torsten Grust ,Hagen Hopfner ,Arantza Illarramendi ,Stefan Jablonski ,Marco Mesiti ,Sascha Muller ,Paula-Lavinia Patranjan ,Kai-Uwe Sattler ,Myra Spiliopoulou ,Jef Wijsen

2006th Edition

3540467882, 978-3540467885

More Books

Students also viewed these Databases questions

Question

2 What are the implications for logistics strategy?

Answered: 1 week ago