test subdirectory
This commit is contained in:
parent
b4dbce76cf
commit
bf7f456967
31 changed files with 19 additions and 13 deletions
19
test/old/parse.c
Normal file
19
test/old/parse.c
Normal file
|
@ -0,0 +1,19 @@
|
|||
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());
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue