What code do I need to use to declare a variable that is a mixture of characters and numbers? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What code do I need to use to declare a variable that is a mixture of characters and numbers?

5th Feb 2017, 4:13 AM
Ritaj J.A
Ritaj J.A - avatar
3 Answers
+ 8
If you're not doing any math on those numbers, the string data type will work just fine. Add this to the top of your code to use it: #include <string>
5th Feb 2017, 4:27 AM
Tamra
Tamra - avatar
+ 3
string myVar = "m4g1c";
5th Feb 2017, 4:26 AM
seamiki
seamiki - avatar
+ 3
thank you so much Tamra & Seamiki. it did work 🖒
5th Feb 2017, 4:32 AM
Ritaj J.A
Ritaj J.A - avatar