-
Notifications
You must be signed in to change notification settings - Fork 3
/
switchend.c
45 lines (44 loc) · 1.32 KB
/
switchend.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Written by cshore (Daniel Dickinson) (although he hates to admit it)
// **************************************************************************
//
// This program is copyright (C) 2009 Daniel Dickinson
// This program is free software; you can redistribute it and/or modify it
// under the terms of version 2 the GNU General Public License as published
// by the Free Software Foundation.
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
// more details.
// To view a copy of the license go to:
// https://www.fsf.org/copyleft/gpl.html
// To receive a copy of the GNU General Public License write the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
#include <stdio.h>
#include <errno.h>
int main(void) {
int a[4], i;
int done = 0;
while(!done) {
for (i = 0; i < 4; i++) {
a[i] = getchar();
if (a[i] == EOF) {
a[i] = 0;
if (!done) {
done = 1 + i;
}
}
}
for (i = 3 ; i >= 0; i--) {
if (done) {
if ((done - 1) <= i ) {
continue;
}
}
putchar(a[i]);
}
}
fprintf(stderr, "\nDone\n");
return 0;
}