dynamic created nested for loops

I amk trying ot think of a method on how to create dynamic nested for loops, although i am unsure on how to accomplish this, for example, i was thinking of a method to test every character combo up to 10 digits length. However its seems ridiculous to insert x for loops for x length, i got sick of it at length 3.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <iostream>

int main(){
    int count = 0;
    for (int i=32; i<127; i++){
        for (int j=32; j<127; j++){
            for (int k=32; k<127; k++){
                char c =  static_cast<char>(i);
                char c2 =  static_cast<char>(j);
                char c3 =  static_cast<char>(k);
                std::cout << c << c2 << c3 << " " << count << std::endl;
                count++;
            }
        }
    }
}
Topic archived. No new replies allowed.