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.
Asked
Active
Viewed 204 times
-3
-
3`std::string`, `std::array`, `std::vector`, `std::tuple`, `std::pair` your own custom `struct`/`class`.. do you need more than that? – Jesper Juhl Mar 05 '19 at 17:28
-
4Sounds like you could use a [good C++ book](http://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list) – NathanOliver Mar 05 '19 at 17:28
-
7Why not just use an `std::string`? – Govind Parmar Mar 05 '19 at 17:28
1 Answers
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.

Govind Parmar
- 20,656
- 7
- 53
- 85