0

Another question about Crack in pset2. Can I have passwords that are mixed with both lowercase and uppercase letters? Like: “PIzzA”?

If so, I’m a little confused on how to write the code to get all these options. Without providing the answer could someone give me a hint or point me in the right direction?

I know how to generate lowercase and uppercase single letters but how do I add: ab, aab, etc?

EDIT: Also, is there a way to do this without using tons of for loops? Or should I watch lecture 3 to learn recursion?

1

Yes, you can have password that are mixed case. I believe you already know how to join strings or individual chars together, for example from exercises where we learn to printf "Hello" + name together. Can you use something like that to join together different chars?

For the question about generating both lower and uppercase letters: have you considered creating a string with all possible characters and iterating through it?

5
  • Hi @gonzo do you mean do something like this: string lower=“abcdefghijklmnopqrstuvwxyz” then looping over the chars? – wolfbagel Apr 13 '19 at 22:49
  • Looking good! Anything keeping you from slapping all the uppercase characters on the end of that bad boy? – Gonzo Nieto Apr 13 '19 at 23:15
  • Oh, ok. I thought I had to create a separate string for upper but I guess not? I can just append the upper to the end of lower? – wolfbagel Apr 13 '19 at 23:20
  • Sounds like it's worth trying :) – Gonzo Nieto Apr 13 '19 at 23:23
  • P.S.: if I answered your question please tag this as answered! :D – Gonzo Nieto Apr 13 '19 at 23:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .