RVBTCC/test/old/parse.c
2024-12-24 09:55:26 +08:00

19 lines
291 B
C

int getchar();
int is_digit(int ch) {
return '0' <= ch && ch <= '9';
}
int parse_int(int ch) {
int num = ch - '0';
while (is_digit(ch = getchar())) {
num = num * 10;
num = num + ch - '0';
}
return num;
}
int main() {
return parse_int(getchar());
}