Two dim arrays require two indexes.
The first index will be for the second row where the data to be searched is: [1]
The second index will be the looping index:i or the min variable pointing to...
Type: Posts; User: Norm
Two dim arrays require two indexes.
The first index will be for the second row where the data to be searched is: [1]
The second index will be the looping index:i or the min variable pointing to...
Change the code in the test program to use a 2 dim array with data in the second row:
int [][] smallestIndex = {{1}, {13,11,12,10,14,15 }} ;
Then change the loop to search the data in the...
Did that code work? It looks like it could.
If it works, then consider what changing the array to two dimensions will do to the coding.
I think the two dim array is confusing you. To learn how to use arrays and the indexes to arrays, try writing a simpler program. Write a new program that defines a short (3 element) array. Write a...
With the following expression: theArray[theIndex]
the value of the contents of the array is given by: theArray[theIndex]
and the value of the index is in the variable: theIndex
It depends on...
The temp array has two dimensions. The righthand reference needs to use TWO indexes, like the lefthand array reference does.
What will the methods in the separate class do?
What is being compared in the if statements in the code in post#19?
if (temp[i][1] < indexLowTemp)
...
if (temp[i][1] > indexHighTemp)
...
Depends on what the assignment says. I use a main() method in the class to be tested that calls all the methods in the class for testing instead of writing a separate class to put the main() method...
A suggestion: write a test program that defines a two dimensional array and uses a nested loop to print out all the elements in the array. That will require you to use indexing to access all the...
You need to format the code so it is easier to read:
Please edit your post and wrap your code with
<YOUR CODE HERE>
to get highlighting and preserve formatting.
Obviously the code is...
what is your question?
A two dim array has two indexes for any element.
Please edit your post and wrap your code with
<YOUR CODE HERE>
to get highlighting and preserve formatting.
You gave the answer here: row 0 coulmn 1
those are the two indexes to the element: 3
Please edit your post and wrap your code with
<YOUR CODE HERE>
to get highlighting and preserve...
Can you explain. I don't understand your question.
The compiler is giving an error because one of the operands in the comparison is an array, not an element of an array.
You can not compare...
temp[i] is an array, not an element of an array
with a 2 dim array, you need two indexes
To look at an element in a two dim array, you need to use two indexes: temp[0][1]
If you want to look at data in only one column, set the second index to the value for that column:...
What are you trying to compare? temp is a two dimensional array. The < operator does not work with arrays.
It would work with elements of an array. For example: temp[1][2]
Please edit your post...