3-Dimensional Arrays?!?
807600Sep 21 2007 — edited Sep 22 2007I've got a lab project that requires me to read in questionnaire data (3 integers) from a file, then put those integers into
a 3-Dimensional array. Here's the idea:
int [][][] poll = new int [4][3][2]; // 4 Age Ranges, 3 Opinions, 2 Genders
int readAge=0, readOpinion=0, readSex=0;
// Read data from file
readAge = scan.nextInt();
readOpinion = scan.nextInt();
readSex = scan.nextInt();
// Store Age, Opinion, Sex into 3D array.
poll[i][j][k] = poll[readAge][readOpinion][readSex]; // ????
Do I need to use a nested for loop (i,j,k) to access and assign this?
How do I put those values into the array?
What's the best way to visualize 3d arrays?