### 3 dimensional array with all possible combinations of the 3 numbers

I have been working on this for a long time. As soon as I think I have all the possible combinations, I think of a few more. There has to be an easier way to this. I am calculating oblique room modes and need any combination of the 3 numbers (representing each dimension of the room) to be fed into an equation. So, I would need 1,2,2; 1,1,2; 1,1,3; 1,2,3; 3,2,1; the list goes on. So far, I have a 3 dimensional array with loops running and have all of the combinations for if all elements increase (aka 1,1,1; 2,2,2) one of the elements increases while 2 remain constant (aka 2,1,1; 3,1,1; 4,1,1; 3,2,2; 4,2,2) and if 2 elements increase while 1 remains constant (aka 1,2,2; 1,3,3; 2,3,3). My problem is that I don't have any which contain combinations of each number being different (like 1,2,3; 1,3,5; 2,4,1; etc.) and for me to do a loop for each of these seems ridiculous. Another tricky part is that I need the loops to stop calculating once a number (frequency "m") is obtained. The variable "m" will be calculated with another formula later. It is just simplified for now. Is there an easier way to do this or do I need a whole bunch more loops?

 ``123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136`` ``````//Modes below the Schroeder Frequency #include #include #include using namespace std; // global variables double l,w,h,temp,c,m,volume,surfaceArea; int a,i,j,k; //declaring global arrays const int NUM=20; // maximum number of modes calculated double mode[NUM][NUM][NUM]; double obliqueModes(double l, double w, double h, double c, double m) { //1 dimension changes per loop for (int j=1; jm) break; } } for (int j=1; jj || im) break; } } for (int j=1; jj || im) break; } } //2 dimensions change per loop for (int j=1; jj || im) break; } } for (int j=1; jj || im) break; } } for (int j=1; jj || im) break; } } } int main () { cout<<"Use this program for a rectangular room to calculate:"<>h;cout<>w;cout<>l;cout<>temp;cout<
Topic archived. No new replies allowed.