forked from paulusja/info1_uebungen
Move io function into own module.
This commit is contained in:
parent
b67837d4d2
commit
9f63d5fa2b
@ -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;
|
|
||||||
}
|
|
||||||
12
02/myio.c
Normal file
12
02/myio.c
Normal file
@ -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;
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user