

 Thread Tools  Search this Thread 
#1
 
 
multi dimension arrays Im having a bit of difficulty with these questions...any help ASAP please 3) You see the subtraction operator () used in a Java program. Does the function of this operator depend on the types of the variable on which it operates? Could the variables on which it operates be of a userdefined type? Give an example of a(nother) language for which the variables could be of a userdefined type. 6) Assume that you have to represent a large number of Boolean values, such as whether or not an alarm is pressed at 1 min intervals. What type of data structure would you use? Explain your choice. 7) Compare the computation time required for retrieving a value from a Java multidimensional array (array of arrays) and from a Fortranstyle multidimensional array. Could you be able to use Fortranstyle arrays in Java, without using the Fortran language? 
#2
 
 
Re: multi dimension arrays A multidimensional array of dimension n (i.e., an ndimensional array or simply nD array) is a collection of items which is accessed via n subscript expressions. For example, in a language that supports it, the tex2html_wrap_inline60030 element of the twodimensional array x is accessed by writing x[i,j]. The Java programming language does not really support multidimensional arrays. It does, however, support arrays of arrays. In Java, a twodimensional array x is really an array of onedimensional arrays: int[][] x = new int[3][5]; The expression x[i] selects the ith onedimensional array; the expression x[i][j] selects the jth element from that array. The builtin multidimensional arrays suffer the same indignities that simple onedimensional arrays do: Array indices in each dimension range from zero to lenght  1 , where length is the array length in the given dimension. There is no array assignment operator. The number of dimensions and the size of each dimension is fixed once the array has been allocated. 
#3
 
 
Re: multi dimension arrays #include <iostream> using namespace std; // DECLARATIONS void printArray (int arg[][3][3], int i, int j, int k) { cout << "\n"; for (int n = 0 ; n < i ; n++) { for (int m = 0 ; m < i ; m++) { for (int l = 0 ; l < i ; l++) { cout << " " << arg[n][m][l] << " "; } cout << "\n"; } cout << "\n"; } cout << "\n"; } int main () { // INPUT int array1[3][3][3] = { { { 1, 2, 3}, { 4, 5, 6}, { 7, 8, 9} }, { {10, 11, 12}, {13, 14, 15}, {16, 17, 18} }, { {19, 20, 21}, {22, 23, 24}, {25, 26, 27} } }; // CALCULATIONS // OUTPUT printArray(array1, 3, 3, 3); // EXIT cout << "\n done.\n"; return 0; } 

Tags: java 
Thread Tools  Search this Thread 

Similar Threads for: "multi dimension arrays"  
Thread  Thread Starter  Forum  Replies  Last Post 
Arrays in C++  Acolapissa  Software Development  3  19122010 10:05 AM 
Problem with 4+ dimension allocatable arrays and optimized code  Tamonash  Software Development  6  29092010 11:59 PM 
How to use an Arrays in PHP?  Jacques25  Software Development  4  25022010 01:24 AM 
Arrays in C#  DotNetUser  Guides & Tutorials  2  03122008 05:31 PM 
Multi Speakers/multi Sound Cards  PeterAGASSI  Hardware Peripherals  5  12112008 11:40 AM 