dot_testing/c/scream.c

23 lines
387 B
C
Raw Normal View History

2020-12-31 18:24:47 -06:00
#include <stdio.h>
#include <ctype.h>
/* written on new year's eve 2020
* good night and good riddance */
char newchar(char c, int i) {
2021-07-16 16:28:09 -05:00
if(i % 2) {
if(islower(c)) return c - 32;
} else if(isupper(c)) return c + 32;
if(c == 33) return -2;
return c;
2020-12-31 18:24:47 -06:00
}
int main(void) {
2021-02-16 10:38:21 -06:00
char c;
2021-07-16 16:28:09 -05:00
int i;
i = 0;
2021-02-16 10:38:21 -06:00
while((c = getchar()) != EOF) {
putchar(newchar(c, i));
2021-07-16 16:28:09 -05:00
i++;
2021-02-16 10:38:21 -06:00
}
2020-12-31 18:24:47 -06:00
}