Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

can you solve this c++ (code blocks) program please Guess a matrix of numbers Assume that A[4][4] is a 4 x 4 two dimensional array.

can you solve this c++ (code blocks) program please

Guess a matrix of numbers Assume that A[4][4] is a 4 x 4 two dimensional array. Write a program that prompts the user to enter the lower and upper limits of an interval, say 1 lower and upper 100. The program uses the predefined functions srand(time(0)) and rand() to generate 16 integer numbers in the interval [lower, upper] and store them in the array A. The program prints a 4 x 4 two dimensional array with the string ?? as the value of each element of the array. The program then asks the user to enter a number in the interval [lower, upper] as a guess of the arrays values. The program prints a 4 x 4 two dimensional array with the all the hidden values of the array if they equal to the entered guessed number, the string if a hidden value of the array is more than the entered guessed value. The program also prints the number of trials the user entered so far. The user should guess all items of the matrix in a minimum number of trials. The program terminates when all numbers are found.

image text in transcribedimage text in transcribedimage text in transcribed

Exercise #2: Guess a matrix of numbers Assume that Al4][4] is a 4 x 4 two dimensional array. Write a program that prompts the user to enter the lower and upper limits of an interval, say 1 Slower and upper S 100. The program uses the predefined functions srand(time(0) and rand() to generate 16 integer numbers in the interval [lower, upper] and store them in the array A. The program prints a 4 x 4 two dimensional array with the string as the value of each element of the array. The program then asks the user to enter a number in the interval [lower, upper as a guess of the arrays values. The program prints a 4 x 4 two dimensional array with the all the hidden values of the array if they equal to the entered guessed number, the string f a hidden value of the array is less than the entered guessed value, the string if a hidden value of the array is more than the entered guessed value. The program also prints the number of trials the user entered so far. The user should guess a items of the matrix in a minimum number of trials. The program terminates when all numbers are found. Sample input/output: Enter the lower and upper limits of an interval the upper limit is less than or equal to 100: 27 36 You have to guess my chosen numbers in a 4 by 4 matrix Try a number between 27 and 36: 31 After 1 trials the matrix is: 31

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

Relational Database Design A Practical Approach

Authors: Marilyn Campbell

1st Edition

1587193175, 978-1587193170

More Books

Students also viewed these Databases questions