how can i change my string type to int type in c++? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

how can i change my string type to int type in c++?

i want to change my int variable to an string,but i dont know how to do it:(

3rd Jul 2018, 2:32 PM
armin
4 Answers
3rd Jul 2018, 2:42 PM
Hatsy Rei
Hatsy Rei - avatar
+ 6
armin You can do this 👇👇 int a = 10 ; string str = to_string(a); cout<<str;
3rd Jul 2018, 2:41 PM
Mohammad Amir Aqeel
Mohammad Amir Aqeel - avatar
+ 1
Use the char values. You can create a string, or probably just char array, and calculate the char value for each number. https://code.sololearn.com/c2apIupGhnuq/?ref=app
3rd Jul 2018, 2:37 PM
Rain
Rain - avatar
+ 1
thank u guys .all of your answers helped me thanks:)
3rd Jul 2018, 3:08 PM
armin