View the step-by-step solution to:

Need help for a user define function find_value , to find and save the locations of all occurrences of a specific value passed to this function. The

Need help for a user define function

find_value, to find and save the locations of all occurrences of a specific value passed to this function.  The function will have 6 arguments - the two dimension data array, the rows and columns for the data array, the locations array, the row size for the locations array (passed by reference), and the value to be found.  If the value is found in the data array, store the location (row and columns offset) where found in the data array into the locations array.  Each time you find the value in the data array the location will be stored in the next row of the locations array.  The row offset will be stored in column 0 and the column offset will be stored in column 1 of the locations array.  Search the two dimension data array by rows


All the variables used:


short data[15][15],       // original data set with 15 rows and 15 columns

        rows,                      // number of rows of data in 2 dimension array

        cols,                       // number of columns of data in 2 dimension array

        locations[225][2],  // array to store the locations (row and column offsets/indices) of the search value

        Rsize,                    // number of rows in locations array that contain a value

        search_value,        // search value entered by user             

        response;               // input from user to continue inner loop




Here is the start:

void find_value(short data[][15], short rows, short cols, short locations[][2], short &Rsize, short searchValue)


Let me know if you need to see my main function.


Language is C++

Top Answer

Output: Enter value to search: 8 Location of 8 in array: 0 7 1 7 2 7 3 7 4 7 5 7 6 7 7 7... View the full answer

printloc-o.JPG

Sign up to view the full answer

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Ask a homework question - tutors are online