Nesting “for” Loop n Times

前端 未结 1 1145
甜味超标
甜味超标 2021-01-19 19:35

I\'m writing a program that finds passwords. I ran into a problem when I saw that the \"for\" loops to replace parts of the password would have to be repeated for the variab

1条回答
  •  孤城傲影
    2021-01-19 20:00

    You do not need to repeat the for loop. Instead you need to nest it.
    The most inviting solution to implement this is a recursive construct.

    Pseudo code:

    void nestloop(int depth, int width)
    {
        if(depth>0)
        {
            int i;
            for (i=0; i

    0 讨论(0)
提交回复
热议问题