What the title says. Basically, I have some code with 12 nested loops based on the code below, and may have to bump it up to 24. This works fine, but seems a little cumbersome, and can't help but think that there's a better way of doing it?

All help gratefully received!

```
#include <iostream>
#include <stdlib.h>
void a ()
{
cout << " a\n";
}
void b ()
{
cout << " b\n";
}
int main(int argc, char *argv[])
{
int x = 0;
for(int i=5;i>0;i--)
{
for(int j=5;j>0;j--)
{
if(j<=i){
for(int k=5;k>0;k--)
{
if(k<=j){
for(int l=5;l>0;l--)
{
if(l<=k){
for(int m=5;m>0;m--)
{
if(m<=l){
for(int n=5;n>0;n--)
{
if(n<=m)
{
for(int o=5;o>0;o--)
{
if(o<=n){
for(int p=5;p>0;p--)
{
if(p<=o){
for(int q=5;q>0;q--)
{
if(q<=p){
for(int r=5;r>0;r--)
{
if(r<=q){
for(int s=5;s>0;s--)
{
if(s<=r){
for(int t=5;t>0;t--)
{
if(t<=s){
x++;
cout <<"Loop: " << x << "\t" << i << j << k << l << m << n << o << p << q << r << s << t;
if(x%2==0) // alternate between functions
{
a();
}
else
{
b();
}
}}
}}
}}
}}
}}
}}
}
}
}}
}}
}}
}}
}
system("PAUSE");
return 0;
}
```