Move io function into own module.
This commit is contained in:
+1
-11
@@ -23,7 +23,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
unsigned char getSingleChar();
|
#include "myio.h"
|
||||||
|
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
@@ -48,13 +48,3 @@ int main()
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char getSingleChar()
|
|
||||||
{
|
|
||||||
unsigned char result = 'a';
|
|
||||||
|
|
||||||
result = getchar();
|
|
||||||
while(result != '\n' && getchar() != '\n') {}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include "myio.h"
|
||||||
|
|
||||||
|
unsigned char getSingleChar()
|
||||||
|
{
|
||||||
|
unsigned char result = 'a';
|
||||||
|
|
||||||
|
result = getchar();
|
||||||
|
while(result != '\n' && getchar() != '\n') {}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user