retab scream.c

This commit is contained in:
randomuser 2021-02-16 10:38:21 -06:00
parent a2055f3deb
commit 55f62d3467
1 changed files with 22 additions and 22 deletions

View File

@ -5,30 +5,30 @@
* good night and good riddance */ * good night and good riddance */
char newchar(char c, int i) { char newchar(char c, int i) {
switch(i) { switch(i) {
case 0: case 0:
if(isupper(c)) return c + 32; if(isupper(c)) return c + 32;
if(c == 33) return -2; if(c == 33) return -2;
else return c; else return c;
case 1: case 1:
if(islower(c)) return c - 32; if(islower(c)) return c - 32;
if(c == 33) return -2; if(c == 33) return -2;
else return c; else return c;
default: return -1; default: return -1;
} }
} }
int advi(int i) { int advi(int i) {
switch(i) { switch(i) {
case 0: return 1; case 0: return 1;
case 1: return 0; case 1: return 0;
default: return -1; default: return -1;
} }
} }
int main(void) { int main(void) {
char c; char c;
int i = 0; int i = 0;
while((c = getchar()) != EOF) { while((c = getchar()) != EOF) {
putchar(newchar(c, i)); putchar(newchar(c, i));
i = advi(i); i = advi(i);
} }
} }