Created
May 8, 2014 12:24
-
-
Save mukulrawat1986/420f4e55c186ad1340a8 to your computer and use it in GitHub Desktop.
C++ function to convert string to int and int to string
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string toString(int a){ | |
ostringstream os; | |
os<<a; | |
return os.str(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int toInt(string s){ | |
int a; | |
istringstream is(s); | |
is>>a; | |
return a; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment