Last active
December 21, 2015 09:09
-
-
Save maksadbek/6283393 to your computer and use it in GitHub Desktop.
int2char'n char2int in C++
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
//from int to char | |
while(n>0){ | |
ch[i]=(n%10)+'0'; | |
n=n/10; | |
i++; | |
} | |
while(i>0){ | |
putchar(ch[i-1]); | |
i-- | |
} | |
//from char to int | |
while(ch >= '0' && ch <= '9') | |
{ | |
n=(n<<3)+(n<<1)+ch-'0',ch=getchar() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment