Created
March 27, 2014 15:48
-
-
Save tairov/9810630 to your computer and use it in GitHub Desktop.
cpp, c++, c, read numbers
This file contains hidden or 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
// Input sequence of numbers | |
while (1) | |
{ | |
ch = getchar_unlocked(); | |
if (ch == EOF) | |
{ | |
// do something with N | |
break; | |
} | |
else if (ch == '\n') | |
{ | |
// do something with N | |
N = 0; | |
} | |
else | |
N = (N << 3) + (N << 1) + ch - '0'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment