My question is, that I'm not sure how to get this done. I have an idea though... but I'm not sure if it is a good way to do this. My idea was to generate at random, the corresponding decimal ASCII codes for the characters, and then use a static cast to make them type char. In doing so, they will be converted to characters... (right?) Well, that's my understanding of how that works, will that idea work? Or will the static cast not produce a character? Is this a good way to do this? Or should I think of a better solution (this one is a bit complicated - considering I'll have to acount for the leading zeroes on the corresponding ASCII decimal values from 000 (null) to 099 (c). Also, I'll have to filter out characters that are not letters or numbers.Code:For this exercise creat a program that outputs a password consisting of sequence of 8 randum upper or lowercase letters or digits. Duplicate characters are permitted.
My guess, is that what I am thinking about, if even do able (think about my static cast) is too complicated for this seemingly easy problem. What do you all think? Is there an easier way to go about doing this?
EDIT: If that way is doable (which I'm not sure it is, the static cast part I'm not sure of) ... would I have to account for the leading zeroes? or...?