View the step-by-step solution to:

# #include &lt;stdio.h&gt; #include &lt;iostream.h&gt; #include &lt;stdlib.h&gt; #include &lt;limits.h&gt; const int ROWSIZE = 2; const int COLSIZE =...

Create a 2-by-3 two-dimensional array of integers and fill it with data. Loop through the array and locate thesmallest value stored. Print out the smallest value as well as its row and column position in the array.

I have the creating of the two-dimensional array down
I have the finding the smalles value down

I need help in how to display the array location (i.e. a[0][1]) for the smallest interger. My code just spits out a[2][3] always.
#include <stdio.h> #include <iostream.h> #include <stdlib.h> #include <limits.h> const int ROWSIZE = 2; const int COLSIZE = 3; int small = 999999999; int row1; int col1; int main() { int values[ROWSIZE][COLSIZE]; int row, col; cout << "Enter a value for row " << 0 << " col " << 0 << ": "; cin >> values[0][0]; cout << "Enter a value for row " << 0 << " col " << 1 << ": "; cin >> values[0][1]; cout << "Enter a value for row " << 0 << " col " << 2 << ": "; cin >> values[0][2]; cout << "Enter a value for row " << 1 << " col " << 0 << ": "; cin >> values[1][0]; cout << "Enter a value for row " << 1 << " col " << 1 << ": "; cin >> values[1][1]; cout << "Enter a value for row " << 1 << " col " << 2 << ": "; cin >> values[1][2]; cout << endl << endl; for (row = 0; row < ROWSIZE; row++) for (col = 0; col < COLSIZE; col++) { cout << "a[" << row << "][" << col << "]: "; cout << values[row][col] << endl; } for (row = 0; row < ROWSIZE; row++) for (col = 0; col < COLSIZE; col++) { if(small > values[row][col]) small = values[row][col]; } printf("\n\nSmallest Interger: %d\n", small); cout << "Located at " "a[" << row << "][" << col << "]\n\n"; return 0; }

Attached image shows the... 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