-3

I'm trying to create a system which receives a password to give you access to a certain file. now I'm having trouble at the start. is there any variable that I can use to combine both numbers and letters? for example something that will store the password "25j3d3". Thank you for your time.

3
  • 3
    std::string, std::array, std::vector, std::tuple, std::pair your own custom struct/class.. do you need more than that? Commented Mar 5, 2019 at 17:28
  • 4
    Sounds like you could use a good C++ book Commented Mar 5, 2019 at 17:28
  • 7
    Why not just use an std::string? Commented Mar 5, 2019 at 17:28

1 Answer 1

2

You don't need to store the individual character types in separate variables (letters, numbers, punctuation) etc. separately. An std::string can hold all character types (it is even binary safe):

std::string password = "abc.,+123\xFF"; 

On a tangent, for storing and processing passwords, obfuscating your code may be a desired effect.

Sign up to request clarification or add additional context in comments.

Comments