diff --git a/02/alphabet.c b/02/alphabet.c index 68bd14f..b83ad59 100644 --- a/02/alphabet.c +++ b/02/alphabet.c @@ -23,7 +23,7 @@ #include #include -unsigned char getSingleChar(); +#include "myio.h" int main() @@ -48,13 +48,3 @@ int main() return 0; } - -unsigned char getSingleChar() -{ - unsigned char result = 'a'; - - result = getchar(); - while(result != '\n' && getchar() != '\n') {} - - return result; -} \ No newline at end of file diff --git a/02/myio.c b/02/myio.c new file mode 100644 index 0000000..3b0c300 --- /dev/null +++ b/02/myio.c @@ -0,0 +1,12 @@ +#include +#include "myio.h" + +unsigned char getSingleChar() +{ + unsigned char result = 'a'; + + result = getchar(); + while(result != '\n' && getchar() != '\n') {} + + return result; +} \ No newline at end of file diff --git a/02/myio.h b/02/myio.h new file mode 100644 index 0000000..c3c8136 --- /dev/null +++ b/02/myio.h @@ -0,0 +1,6 @@ +#ifndef MYIO_H +#define MYIO_H + +unsigned char getSingleChar(); + +#endif \ No newline at end of file