From 57d767cf4e4d5b83645bda2c4e398fdd76d059e1 Mon Sep 17 00:00:00 2001 From: Raphael McSinyx Date: Mon, 2 Jan 2017 20:37:59 +0700 Subject: Update others/easy20160714 --- others/easy20160714/17.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 others/easy20160714/17.c (limited to 'others/easy20160714/17.c') diff --git a/others/easy20160714/17.c b/others/easy20160714/17.c new file mode 100644 index 0000000..edc8f1c --- /dev/null +++ b/others/easy20160714/17.c @@ -0,0 +1,21 @@ +#define _GNU_SOURCE +#include +#include + +int main() +{ + FILE *fi = fopen("INP.TXT", "r"), *fo = fopen("OUT.TXT", "w"); + char c, prevc = 32; + + while ((c = fgetc(fi)) != EOF) { + if (prevc ^ 32) + fputc(isupper(c) ? c + 32 : c, fo); + else if (c ^ 32) + fputc(islower(c)) ? c - 32 : c, fo); + prevc = c; + } + + fcloseall(); + + return 0; +} -- cgit 1.4.1