Question: Write a C++ program that creates a 2-D array of characters with size 30 40. Initial the whole 2- D array with character as. Then

Write a C++ program that creates a 2-D array of characters with size 30 40. Initial the whole 2- D array with character as. Then program should ask for user input ten times. Each time ask for 3 user input: a row number, a column number, and a character. The program should put the character read from the user into the array at the given row and column position. For example, if user enters 5 9 d, which means put the character d at location row 5 column 9 in the array. If the location is out of the bounds for the 30 40 array, display error message. The program should ask for user input 10 times (invalid input does not count) which means 10 user picked characters will be stored in the 2-D array. After the 10 input, print the whole 2-D array by calling the print_array() function. (see the requirement of the print_array() function) Then in the main function, call the find() function and print the location of the target character. Before calling the function, ask user to choose the target character. If the target character is not found, print not found, otherwise display the location of it. (See the requirement of the find() function.) Write a function, print_array(), to print the array. The 2-D array should be passed to the print_array() function. Write a function called find(). The function takes four parameters: a 2-Dimensional array of characters, the target character and 2 integers. The function must check each element of the array to find the target character which was set by the user. If the element contains the specific character, the function should set the two integer parameters to the x and y position of the character. You may assume the size of the array is defined as global variables named Width and Height.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!