Is there a variable that can hold string and int in the same time?
If not, what can I do if I want to input data with string and int like a password for an example.
Is there a variable that can hold string and int in the same time?
If not, what can I do if I want to input data with string and int like a password for an example.
Why you wants to do so?
You can ask for it separately instead of in pair.
All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.
I know that but what if someone wants to make a username or a password that contains letters and numbers.
How can I make the program accept such data.
Thank you.
O_o
What you are thinking of as "number" is just convention of numerals.
The C++ notion of `int' and `std::string' are different types of objects which also have conventions.
The "values" "one" and "1" both represent the same thing by convention, but both are composed of "glyphs" representing characters with which you are familiar.
Each of 'o', 'n', 'e', and '1' are all just----type `char'--characters, and in C++, `std::string' is a collection of characters.
If you can express what you are thinking of in terms of "these are characters", you can just use a `std::string' to store the information.
You do not need to interpret "one1" as a `std::string' and an `int'; you can just store the value as a `std::string' and interpret the value as four different characters.
Soma
“Salem Was Wrong!” -- Pedant Necromancer
“Four isn't random!” -- Gibbering Mouther