capslock
This commit is contained in:
parent
e0144a011a
commit
c74c7e09d6
@ -1,5 +1,4 @@
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
int main() {
|
||||
char input_char;
|
||||
@ -12,17 +11,26 @@ int main() {
|
||||
break;
|
||||
}
|
||||
|
||||
if (islower(input_char)) {
|
||||
printf("%c", toupper(input_char));
|
||||
} else if (isupper(input_char)) {
|
||||
printf("%c", tolower(input_char));
|
||||
} else if (input_char == '\n') {
|
||||
line_count++;
|
||||
printf("%c", input_char);
|
||||
} else if (isprint(input_char)) {
|
||||
// Print visible characters as they are
|
||||
printf("%c", input_char);
|
||||
|
||||
if (input_char >= 'a' && input_char <= 'z') {
|
||||
input_char = input_char - 'a' + 'A';
|
||||
}
|
||||
|
||||
else if (input_char >= 'A' && input_char <= 'Z') {
|
||||
input_char = input_char - 'A' + 'a';
|
||||
}
|
||||
|
||||
else if (input_char == '\n' || (input_char >= 32 && input_char <= 126)) {
|
||||
if (input_char == '\n') {
|
||||
line_count++;
|
||||
}
|
||||
} else {
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
printf("%c", input_char);
|
||||
}
|
||||
|
||||
printf("%d\n", line_count);
|
||||
|
Loading…
Reference in New Issue
Block a user