His must be in C++ You want to write a program that will determine how many matching values there are (looking at each element of two arrays) and displaying that value. The program should have an array of six integers named ArrayOne, with a randomly generated number (hint: use a seed value, srand and rand functions OR the random_device method discussed in Chpater 3 of Revel) in the range of 0 through 5 for each element in the array. The program must call a function (passing the ArrayOne array into it). This function will assign the randomly generated values into ArrayOne. After ArrayOne is populated, you then need to ask the user to enter six digits and store them in a second array named ArrayTwo. I recommend, but do not require, passing ArrayTwo into a separate function to do this. After each array is populated, use a separate function call (by passing both arrays into the f
THis must be in C++
-
You want to write a
program that will determine how many matching values there are (looking at each element of two arrays) and displaying that value. The program should have an array of six integers named ArrayOne, with a randomly generated number (hint: use a seed value, srand and rand functions OR the random_device method discussed in Chpater 3 of Revel) in the range of 0 through 5 for each element in the array. The program must call a function (passing the ArrayOne array into it). This function will assign the randomly generated values into ArrayOne. After ArrayOne is populated, you then need to ask the user to enter six digits and store them in a second array named ArrayTwo. I recommend, but do not require, passing ArrayTwo into a separate function to do this. After each array is populated, use a separate function call (by passing both arrays into the function) inside which you will compare each element of the two arrays for matches. The function should count how many of the digits match (for it to be considered a match, the same value must be in the exact same position in both arrays) and return the matching number to the main program. For example, the following shows the contents of the ArrayOne array and the ArrayTwo array with sample numbers stored in each. There are two matching digits, at index 2 and 5.ArrayOne:
1 5 4 1 3 3
ArrayTwo:4 2 4 5 2 3 Once the user has entered a set of numbers, the program should then display the computer-generated digits (ArrayOne) and the user's digits (ArrayTwo) and tell how many of the digits matched. Display only the total number of matches in the two arrays. If there are no matches, then display the message that there were no matches between the two arrays. In this case, the message to the user might read:
For the two arrays, there are exactly 2 matches within the array values.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 4 images