I am badly struck at the Crack problem in pset2.
I have an idea which uses 5 for loops, to check for all the possible variations of the alphabets. Considering a case where the password is only of upper case, here's an example of the loops combining to give all possible variations of the alphabets. I can't get this to work. Please help!
char password[5];
for (int i=0; i<26; i++)
{
password[0] = i;
for (int j=0; j<26; j++)
{
password[1] = j;
for (int k=0; k<26; k++)
{
password[2] = k;
for (int l=0; l<26; l++)
{
password[3] = l;
for (int m=0; m<26; m++)
{
password[4] = m;
for (int n=0; n<5; n++)
{
password[n] += 'A';
}
printf("%s\n",password);
sleep(1);
}
}
}
}
}